Sabid Ansari

Sabid Ansari

150 Articles Published

Articles by Sabid Ansari

Page 15 of 15

Check if the given characters is present in Golang String

Sabid Ansari
Sabid Ansari
Updated on 07-Apr-2023 6K+ Views

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 More

Channel in Golang

Sabid Ansari
Sabid Ansari
Updated on 07-Apr-2023 1K+ Views

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 More

Calculating total number of Hours, Days, Minutes and Seconds between two dates in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 1K+ Views

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 More

Buffered Channel in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 713 Views

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 More

Bits Package in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 705 Views

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 More

Basics of JSON with GoLang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 581 Views

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 More

Base64 Package in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 371 Views

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 More

Auto Format Go Programming Language Source Code with Gofmt

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 584 Views

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 More

Atomic Variable in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 2K+ Views

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 More

Anonymous Structure and Field in Golang

Sabid Ansari
Sabid Ansari
Updated on 06-Apr-2023 2K+ Views

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
Showing 141–150 of 150 articles
« Prev 1 11 12 13 14 15 Next »
Advertisements