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.1k Mac OSX : Homebrew and Golang
+6.1k RPM : error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
+3.1k Golang : alternative to os.Exit() function
+2.4k Golang : Calculate diameter, circumference, area, sphere surface and volume
+4.4k Gogland : Where to put source code files in package directory for rookie
+6.9k Swift : Convert (cast) Int or int32 value to CGFloat
+2.7k Golang : How to stop user from directly running an executable file?
+15.3k PHP : Count number of JSON items/objects
+2.7k Golang : Combine slices of complex numbers and operation example
+3k Golang : Add ASCII art to command line application launching process
+2.3k Get website traffic ranking with Similar Web or Alexa
+7.3k Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader