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
+7.4k Golang : Command line ticker to show work in progress
+9.4k Golang : Sort and reverse sort a slice of floats
+19.7k Golang : Reset or rewind io.Reader or io.Writer
+5k Golang : Calculate half life decay example
+10.4k Android Studio : Checkbox for user to select options example
+9.5k Golang : ffmpeg with os/exec.Command() returns non-zero status
+5.2k Javascript : How to loop over and parse JSON data?
+6.1k Golang : Selection sort example
+6.9k Golang : Squaring elements in array
+9.1k Golang : Find the length of big.Int variable example
+4.6k HTTP common errors and their meaning explained
+17.4k Convert JSON to CSV in Golang