Golang atoi: How to Use Atoi() Function in Go

How to Use Atoi() Function in Golang

Golang provides a built-in package called strconv for conversions like string to int and int to string. Parse methods would return an error if they received invalid input. Golang Atoi Golang Atoi() is a built-in function that comes with a strconv package used to convert a given string in the given base (10) and bit size (0) into … Read more

How to Append a Slice in Golang

How to Append a Slice in Golang

To append a slice in Golang, use the append() function. The append() is a built-in Go function used to append elements to a slice. As per the official Go documentation, the following is the signature of the append() function from the built-in package. As we know, arrays in Go are statically-sized, which means once created, their … Read more

How to Convert Golang Int to String

How to Convert Golang Int to String

Go provides numerous different types to represent the numbers. When we speak of numbers, we divide the numbers into two different types: integers floating-point numbers. Golang integer has two types. signed integer: int8, int16, int32, int54 unsigned integer: uint8, uint16, uint32, uint64 Golang string is a sequence of variable-width characters where each character is defined … Read more

How to Create a Byte Array in Golang

How to Create a byte array in Golang

Go has integer types called byte and rune epithets for uint8 and int32 data types. In Go, there is no char data type. Instead, it uses byte and rune to represent character values. The []byte and string in Go are small headers pointing to data that have lengths suggesting how much data is present. The []byte has two lengths: The current length of the data. Capacity. A byte … Read more

Golang Itoa: How to use strconv.Itoa() Function

Golang Itoa - How to use strconv.Itoa() Function

Go provides built-in support to execute conversions to and from string expressions of basic data types using the strconv Package. The most familiar numeric conversions are converting string to int using Atoi() and converting int to string using Itoa() function in Go. In this article, we will learn what is strconv.Itoa() function and how to … Read more

How to Convert Byte Array to String in Golang

How to Convert Byte Array to String in Golang

A byte in Golang is an unsigned 8-bit integer. A byte has a limit of 0-255 in the numerical range. It represents an ASCII character. Golang uses rune, which has type int32 in which you can deal with multibyte characters. Golang byte array to string To convert the byte array to string in Golang, use the string() constructor. The … Read more

Golang FormatInt: strconv.FormatInt() Function Guide

Golang FormatInt - strconv.FormatInt() Function Guide

The strconv package in Go provides numerous methods for converting to and from string representations of basic data types.  Golang FormatInt The strconv.FormatInt() is a Golang function used to convert an integer data type to a string data type. The FormatInt() function accepts an integer and converts based on the base value, returning a string … Read more