go FormatUint(),无符号整数转换为string
FormatUint()方法语法
func FormatUint(i uint64, base int) string
go源码对FormatUint()方法的介绍:
FormatUint returns the string representation of i in the given base, for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10.
即,golang的strconv.FormatUint方法,可以将无符号整数i转换为base指定进制的字符串表示,其中base的进制值介于2到36之间,大于十进制的大于等于10的一般使用a到z的字母表示,如下面的实例。
strconv.FormatUint()方法实例代码
10进制中的255在16中表示FF或(ff):
func main() {
var str string = strconv.FormatUint(255, 16)
fmt.Println(str)
}
运行go文件,得到输出:
ff