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
+18.6k Golang : How to get time from unix nano example
+19.5k Golang : Convert PNG transparent background image to JPG or JPEG image
+3.7k Javascript : Access JSON data example
+4.8k nginx : force all pages to be SSL
+5.7k PHP : Shuffle to display different content or advertisement
+7.9k Golang : Get curl -I or head data from URL example
+18.4k Golang : Count JSON objects and convert to slice/array
+16.2k Golang : How to make a file read only and set it to writable again?
+7.9k Golang : Apply Histogram Equalization to color images
+35.3k Golang : Convert(cast) int64 to string
+10.8k Golang : Decompress zlib file example
+12.1k Golang : Image to ASCII art example