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
+11.1k Golang : Pagination with go-paginator configuration example
+16.5k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+12.3k Swift : Convert (cast) Int to String ?
+8.3k Golang : Generate Codabar
+18.3k Mac OSX : Homebrew and Golang
+17k Golang : Get all upper case or lower case characters from string example
+13.9k Golang : ROT47 (Caesar cipher by 47 characters) example
+35.4k Golang : Display float in 2 decimal points and rounding up or down
+7k Golang : Ways to recover memory during run time.
+8k Golang : Capture text return from exec function example
+8.2k Golang : Write multiple lines or divide string into multiple lines
+17.4k Golang : Find IP address from string