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.9k Golang : Interfacing with PayPal's IPN(Instant Payment Notification) example
+14.4k Golang : Logging with logrus
+8.5k Golang : Get month name from date example
+16.1k Golang : Read input from console line
+62.6k Golang : How to return HTTP status code?
+15.2k Golang : Read directory content with os.Open
+13.1k Golang : Read a file line by line
+13.2k Golang : How to get own program name during runtime ?
+11.3k Golang : Parsing or breaking down URL
+3.1k HTTP common errors and their meaning explained
+3.9k Golang : Measure execution time for a function