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
+13.9k Golang : Chunk split or divide a string into smaller chunk example
+9.9k Golang : How to get quoted string into another string?
+10.9k Google Maps URL parameters configuration
+8k Golang : Qt splash screen with delay example
+11.4k Golang : Surveillance with web camera and OpenCV
+13.8k Golang : Fix image: unknown format error
+11.7k Golang : Detect user location with HTML5 geo-location
+6.4k Golang : Warp text string by number of characters or runes example
+6.6k Android Studio : Hello World example
+30.7k Golang : Calculate percentage change of two values
+3.8k Detect if Google Analytics and Developer Media are loaded properly or not
+6.6k Golang : Calculate pivot points for a cross