In this article, we will see how to write a Go program that generates random strings with different character sets using a function called randomHash. First, we need to import the following packages Now, we have to create a character…
Programming
In this article, we will see efficient ways to split a string by length in Python. There are multiple ways to split a string by length in python, from those different ways, which one to use is depends upon the…
In this article, we will see how to implement the random sleep in Golang using the time and math/rand packages. The time package in Golang has a function called the time.Sleep to pause the execution of a program for a…
In this article, we will see how to calculate the number of days between two dates using the go programming language. To achieve this, we use the time package from the go standard library. Here, the input that we get…
In this article, we will see how to change the DateTime format in Golang using the time package. We also see how to parse and format the DateTime values. Parsing: You must first parse the date string into a time.Time…
In this article, we will see how to validate a date string format in Golang. To achieve this we use the time package. To validate a date string format, you can use the time.Parse function. The time.Parse function takes two…
In this article, we will see how to list the directories, subdirectories and files recursively. Here, we use thefilepath.Walk function to recursively traverse a directory and its subdirectories to list all the directories, subdirectories, and files efficiently. Following is the…
In this article, we will see how to unmarshal nested json data as a string/raw json data using Json.RawMessage. There are several use cases of delaying the json decoding using the RawMessage. json.RawMessage is mostly used for handling JSON data…
In this article, we will see how to generate a random date between two dates in golang. In golang, we can use Date function in the time package to generate a random date between two dates. Following is the example…
In this article, we will see how to split a string by its length in golang. We can easily do this by using the slice expression. It represents a portion of the string s that starts at index i and…