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
+6.1k Golang : How to verify input is rune?
+9.5k Golang : Apply Histogram Equalization to color images
+12.6k Golang : Arithmetic operation with numerical slices or arrays example
+18.9k Golang : Implement getters and setters
+18k Golang : Qt image viewer example
+8.9k Golang : On lambda, anonymous, inline functions and function literals
+21.6k Curl usage examples with Golang
+7.3k Golang : Dealing with postal or zip code example
+7.6k Golang : Rot13 and Rot5 algorithms example
+26k Golang : How to read integer value from standard input ?
+6.2k Golang : Scan forex opportunities by Bollinger bands