Golang : Convert uint value to string type
Problem :
You have an uint value and you want to convert(cast) the value into string.
Solution :
Use strconv.FormatUint()
function to convert the uint64 value to string.
For example :
package main
import (
"fmt"
"strconv"
)
func main() {
var uval uint64 = 1 * (1 << 20)
str := strconv.FormatUint(uval, 10)
fmt.Println(str) // uint64 in string format
}
See also : Golang : Convert(cast) int to int64
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+21.7k Golang : How to read float value from standard input ?
+19.4k Golang : Populate dropdown with html/template example
+17.7k Golang : Clone with pointer and modify value
+39.8k Golang : Remove dashes(or any character) from string
+20.9k Android Studio : AlertDialog and EditText to get user string input example
+9.9k Golang : Format strings to SEO friendly URL example
+5.7k Unix/Linux : How to find out the hard disk size?
+35.3k Golang : Upload and download file to/from AWS S3
+48.7k Golang : Upload file from web browser to server
+31.9k Golang : Get local IP and MAC address
+7.5k Golang : Accessing dataframe-go element by row, column and name example
+6.6k Grep : How to grep for strings inside binary data