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
+16.9k Golang : XML to JSON example
+12.5k Golang : Transform comma separated string to slice example
+21.8k Golang : Join arrays or slices example
+9.9k Golang : Test a slice of integers for odd and even numbers
+14.7k Golang : Basic authentication with .htpasswd file
+12.3k Golang : "https://" not allowed in import path
+36.2k Golang : Convert(cast) int64 to string
+4.5k Javascript : Access JSON data example
+29.2k Golang : Record voice(audio) from microphone to .WAV file
+11.4k Golang : Find age or leap age from date of birth example
+6k Golang : How to write backslash in string?
+5.1k JavaScript/JQuery : Redirect page examples