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
+14.4k Golang : Loop each day of the current month example
+40.6k Golang : Convert []byte to image
+7.8k Golang : Get final balance from bit coin address example
+8.2k Golang : How to get garbage collection data?
+11.1k Golang : Display list of countries and ISO codes
+9.1k Golang : Embed secret text string into binary(executable) file
+4.8k Unix/Linux : Get reboot history or check when was the last reboot date
+6k Golang : Mapping Iban to Dunging alphabets
+16.5k Golang : Aligning strings to right, left and center with fill example
+10.5k Golang : Sort and reverse sort a slice of runes
+6.9k Golang : Configure Apache and NGINX to access your Go service example
+5.1k Golang : Scan forex opportunities by Bollinger bands