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
+13.5k Golang : Rename directory
+8.6k Golang : Populate slice with sequential integers example
+4.5k Golang : Stop goroutine without channel
+4k Golang : Print instead of building pyramids
+8.7k Golang : Identifying Golang HTTP client request
+6.9k Golang : Load DSA public key from file example
+24.6k Golang : missing Mercurial command
+11.1k Golang : calculate elapsed run time
+35k Golang : Display float in 2 decimal points and rounding up or down
+29.6k error: trying to remove "yum", which is protected
+6k Golang : Mapping Iban to Dunging alphabets
+4.9k CodeIgniter/PHP : Remove empty lines above RSS or ATOM xml tag