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
+5.2k Golang *File points to a file or directory ?
+7.9k Golang : Add build version and other information in executables
+22.2k Golang : Convert Unix timestamp to UTC timestamp
+5.8k Golang : How to verify input is rune?
+7.2k Golang : Rot13 and Rot5 algorithms example
+19.8k Swift : Convert (cast) Int to int32 or Uint32
+7.8k Golang : Variadic function arguments sanity check example
+18.3k Golang : Set, Get and List environment variables
+7.6k Golang : Load DSA public key from file example
+38.8k Golang : How to iterate over a []string(array)
+8.3k Android Studio : Import third-party library or package into Gradle Scripts