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.3k Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader
+4.7k Golang : Grab news article text and use NLP to get each paragraph's sentences
+7k Golang : Get final or effective URL with Request.URL example
+11.6k Golang : Transform comma separated string to slice example
+7.3k Golang : How to check if input string is a word?
+12.5k Golang : Human readable time elapsed format such as 5 days ago
+8.6k Golang : How to check if a website is served via HTTPS
+4.2k Python : Convert(cast) string to bytes example
+8.6k Golang : Turn string or text file into slice example
+6.6k Gogland : Single File versus Go Application Run Configurations
+6k Golang : Fibonacci number generator examples
+8.2k Golang : Read file with ioutil