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
+15.6k Golang : How to convert(cast) IP address to string?
+32.2k Golang : Validate email address with regular expression
+10.7k Golang : Resolve domain name to IP4 and IP6 addresses.
+15.3k Golang : How to get Unix file descriptor for console and file
+6.6k Golang : Totalize or add-up an array or slice example
+5.8k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+6.1k Golang : Convert Chinese UTF8 characters to Pin Yin
+8.7k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+5.8k Golang : Markov chains to predict probability of next state example
+18.6k Golang : Generate thumbnails from images
+10.1k Golang : Edge detection with Sobel method
+17.7k Convert JSON to CSV in Golang