Category: Golang

Convert Int To String in Golang | Itoa and FormatInt

In this blog, we will take a look at conversion in golang, primarily how to convert int to string in Golang. Let’s First understand the typical behaviour of Golang String Literal. Learn Golang Datatypes to understand it better. Golang Rune Rune Data type in Golang is an alias for int32. It is primarily used to…
Read more

Golang UTF8 Package – Text Encoding

In this blog, we will learn about the Golang UTF8 Package and Character Encoding in Programming Languages. The Golang Unicode/utf8 package provides several useful functions for querying and manipulating strings and []bytes which hold UTF8 bytes. First of all lets understand the difference between UTF8 and ASCII Encoding. ASCII vs UTF8 Encoding In earlier days…
Read more

Golang Strings.Map() – Replace Characters from String

In the previous blog, we learned how to replace a string in Golang using the Replace and ReplaceAll Function. This time we will learn how we can Replace Characters from a String in Golang using the strings.Map() Function. First of all, you should know how the Replace and ReplaceAll function works to understand the strings.Map()…
Read more

How to Replace String in Golang?

In this blog, we will learn How to Replace String in Golang, using Replace and ReplaceAll Function present in the strings package. Learn about How to split String by delimiter? and also Split string using FieldsFunc Golang String Replace func Replace(s, old, new string, n int) string The strings.Replace() function takes a string to work…
Read more

Golang FieldsFunc to Split String

In the previous blog, we learned how to split string in Golang. This time we will learn about the Golang FieldsFunc function present in the strings package. In this example, we will use the Golang FieldsFunc to split string by space delimiter. Learn about How to Split String in Golang using Split, SplitN, and SplitAfter…
Read more

Golang Split String by Delimiter Using Split, SplitN, and SplitAfter

In this blog, we will learn how to split string by delimiter in Golang using Split, SplitN and SplitAfter Functions present in the strings package. Learn how to compare strings in Golang. Golang Split String to Array func Split(s, t string) []string The Split function takes a string to split and a separator string to…
Read more

How To Compare Strings in Golang

In this blog, we will learn how to compare strings in Golang. First we will learn simple string comparison in Golang using relational operator  i.e, ==, !=, >=, <=, <, >. Compare String using Relational Operators String Comparision in Golang using the relational operators is case-sensitive. Let’s see another way of comparing strings i.e compare function…
Read more

Golang Imports, Types of Imports & Blank Identifier

In this blog, we will take a look at how Golang imports packages in order to access the code functionality. In the previous blog, we looked at the organization of code into Golang Packages, Workspace, and Environment variables like GOROOT and GOPATH. Golang Import The import statement tells the go compiler where to look on…
Read more

Golang Set GOPATH and GOROOT

In this blog, we will take a look at how code is organized in Golang into packages, how to interact with Golang packages, and how to Set GOPATH and GOROOT. Packages are one of the most important concepts in Golang. Golang Packages helps us to separate semantic units of functionality into different packages. This also…
Read more

go run vs go build – Go command-line tools

In this blog, we will take learn the differences between go run vs go build command-line tools. The Go Language comes with go command-line tools that help us to execute certain operations on the code or program using the command line interface. Before go run vs go build, let’s take a look at both the…
Read more