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.2k Golang : How to use if, eq and print properly in html template
+15.2k Golang : Get query string value on a POST request
+6k Golang : Create new color from command line parameters
+29k Golang : Get first few and last few characters from string
+18.4k Golang : Write file with io.WriteString
+31.4k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+33.6k Golang : All update packages with go get command
+14.3k Android Studio : Use image as AlertDialog title with custom layout example
+9.3k Golang : How to get username from email address
+7.8k Golang Hello World Example
+15k Golang : package is not in GOROOT during compilation
+6k Golang : Experimenting with the Rejang script