Golang math.Floor() function: How to Use it

Golang math.Floor() function - How to Use it

Go provides a math package that has functions to find absolute value, power of input, floor value, round value, and ceil values. In this article, we will find out how to get the floor value of an input. Golang math.Floor() The math.Floor() is a built-in Golang function that returns the greatest integer value less than … Read more

How to Convert Golang Float to Int

How to Convert Golang Float to Int

An integer is an immutable data type, so converting a float to an int is the most common operation. Before starting our main course, let’s see the float and integer data types. What is float in Golang? The float data type in Golang is used to store positive and negative numbers with a decimal point.  … Read more

How to Print Data Type in Golang Console

How to Print Data Type in Golang Console

Formatting integers and strings are simple yet powerful process to show data to users. Using the fmt package, you can format numbers and strings padded with spaces or zeroes, in different bases, and with optional quotes. The fmt package functions accept the template string that includes the text you need to format plus other annotation verbs and … Read more

How to Append a Slice in Golang

How to Append a Slice in Golang

Slice is an important data structure in Go because it is a variable-length sequence that stores elements of a similar type that are not allowed to store different elements. What is a slice in Go? Golang slice is a dynamically-sized, flexible view into the elements of an array. The slice type is an abstraction built … Read more

Golang reflect.TypeOf: How to Find Data Type in Go

Golang reflect.TypeOf - How to Find Data Type in Go

Finding a data type of variable is a repetitive task a developer must regularly perform. Converting one data type to another, checking if the variable has the same or a different data type, or printing in the console for debugging purposes. Every problem requires finding the current data type of the existing variable. How to … Read more

How to Convert Golang int64 to String

How to Convert Golang int64 to String

The strconv package provides functions and utilities that help us convert from and to string values. Go provides an int data type that can be declared as an int which will only store signed numeric values. An integer can be int, int64, or int128.  In this article, we will go through what int64 is and how … 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 int to string using Itoa() function in Go. Let’s see the Itoa() function and how to use it. Golang Itoa The strconv.Itoa() … 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 that converts 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 data type … Read more

Golang: Converting a String to an Int64

Golang- Converting a String to an Int64

The strconv package executes conversions to and from string representations of basic data types like int32, int64, float, etc. What is an int64 in Go? Data types from int store signed integers, and those from uint contain unsigned integers. A variable of type int64 can store integers ranging from -9223372036854775808 to **9223372036854775807. Golang String to Int64 To convert a … Read more