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
+9.7k Golang : How to extract video or image files from html source code
+27.1k Golang : Force your program to run with root permissions
+8.4k Swift : Convert (cast) Character to Integer?
+4.5k Linux/MacOSX : Search and delete files by extension
+15.6k Golang : Find location by IP address and display with Google Map
+36.5k Golang : Convert date or time stamp from string to time.Time type
+5.5k Unix/Linux/MacOSx : How to remove an environment variable ?
+19.4k Golang : Check whether a network interface is up on your machine
+12.9k Golang : Listen and Serve on sub domain example
+18.1k Golang : Defer function inside init()
+7.1k Golang : constant 20013 overflows byte error message