Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Sabid Ansari
Page 15 of 15
Check if the given characters is present in Golang String
Presence of a specific character or group of characters in a string is a typical procedure when working with strings. Several methods for determining whether specific characters are present in a Golang string will be covered in this article. Using the strings.Contains() Function Using the built-in strings is the simplest approach to determine whether a character or substring is contained in a Golang string. the contains() function. A boolean value indicating whether the substring was discovered in the string is returned by this function, which requires two arguments: the string to search for and the substring to look for. Here ...
Read MoreChannel in Golang
Channels in Golang are useful for transferring data and coordinating the execution of goroutines. We will go over what channels are, how they operate, and how to use them successfully in Golang in this article. What are Channels? In Golang, channels are a means of data synchronisation and communication between goroutines. A channel primarily functions as a message queue that enables communication between goroutines. Without the requirement for explicit locking or synchronisation, channels offer a secure and effective method of data sharing between goroutines. How Channels Work Channels in Golang are implemented using the chan keyword. Channels can be created ...
Read MoreCalculating total number of Hours, Days, Minutes and Seconds between two dates in Golang
Calculating the total number of hours, days, minutes, and seconds between two dates is achievable in Golang. In this article, we'll go through how to accomplish this in Golang, along with the necessary libraries and sample code. Calculating the Total Number of Hours, Days, Minutes, and Seconds In Golang, we may utilise the time package to determine how many hours, days, minutes, and seconds are there between two dates. To modify dates and times, the time package offers a number of functions. The total number of hours, days, minutes, and seconds between two dates can be calculated in Go ...
Read MoreBuffered Channel in Golang
A buffered channel in Golang is a particular kind of channel that enables several values to be transmitted and received without blocking. In this post, we'll talk about buffered channels in Golang, their syntax, and some real-world uses. What is a Buffered Channel? In Golang, a channel type that can keep a predetermined number of values before blocking is known as a buffered channel. As long as there is space in the buffer, this permits sending and receiving numerous values without blocking. Any additional attempts to send data will be blocked after the buffer is filled until more room is ...
Read MoreBits Package in Golang
Bits package in Golang has functions for changing a binary number's individual bits. This package is very helpful in low-level applications like networking, cryptography, and bitwise operations. This post will go through the Golang bits package and show you how to utilise it in a real-world application. Introduction to the Bits Package The bits package offers tools for working with a binary number's constituent bits. The "BitArray" type, which represents a series of bits, is the main type in the bits package. An implementation of the "BitArray" type is a slice of "uint64" values, where each "uint64" value has ...
Read MoreBasics of JSON with GoLang
JSON has grown in popularity as a data format for transferring data across apps in recent years. JSON (JavaScript Object Notation) is a compact and simple-to-understand standard for exchanging data. It is widely used in server-to-server communication, mobile applications, and web applications. Its simplicity, concurrency, and scalability make GoLang a powerful programming language. The fundamentals of JSON with GoLang will be covered in this post. What is JSON? JSON is a simple, lightweight data exchange format that is simple for both people and robots to comprehend and generate. It is a completely language-independent text format that adheres to principles that ...
Read MoreBase64 Package in Golang
Base64 package in Golang is a standard library package that offers capabilities for base64-encoding and -decoding binary data. Base64 is a popular method of encoding that enables binary data to be represented using just sharable ASCII letters, making it perfect for transmission over text-based protocols like HTTP and SMTP. We'll look into the Golang base64 package and discover how to encrypt and decrypt data in base64 format using the package's functions. We'll also talk about the best ways to interact with binary data in Golang and examine some typical use cases for base64 encoding and decoding. You ought to be ...
Read MoreAuto Format Go Programming Language Source Code with Gofmt
Let's look at how ‘gofmt’ can automatically style your Go source code in a consistent manner so that it is easier to understand and manage. In order to write readable, maintainable code, it must be formatted correctly. Go source code can be formatted using the 'gofmt' command-line tool. Using a set of rules and conventions, this programme automatically reformats your Go code to make it simpler to read and comprehend. What is Gofmt? A command-line tool called Gofmt is used to format Go source code consistently. Your code's space, indentation, and line breaks are automatically adjusted to make it easier ...
Read MoreAtomic Variable in Golang
Atomic Variable in Golang offer an alternative to use locks or other synchronisation primitives to execute atomic operations on shared variables. When programming concurrently, synchronisation and mutual exclusion are essential to ensuring that threads or processes can access shared resources without interfering with one another. The fast and scalable synchronisation and coordination of concurrent access to shared variables is made possible by the use of atomic variables. What is an Atomic Variable? An atomic variable is a shared variable that may be read from and written to simultaneously by several goroutines while still ensuring that all actions are atomic. The ...
Read MoreAnonymous Structure and Field in Golang
Anonymous structures and fields in Golang are a powerful feature that can be used to simplify and improve the readability of your code. These constructs allow you to define new data types on the fly without having to create a new named struct. Let's examine anonymous fields and structures in Go in more detail. What is an Anonymous Structure? In Go, a structure is a collection of fields that can be used to define a new data type. Normally, you would define a named structure like this − type Person struct { Name string ...
Read More