go AppendInt()

AppendInt()方法语法

func AppendInt(dst []byte, i int64, base int) []byte

go源码对AppendInt()方法的介绍:

AppendInt appends the string form of the integer i, as generated by FormatInt, to dst and returns the extended buffer.

即,golang的strconv.AppendInt()方法,可以将int64整数类型值转换为base指定的进制的字符串表示,然后Append添加到dst切片之中,返回值为一个新的切片。


strconv.AppendInt()方法实例代码

func main() {
	var IntBytes []byte
	new_IntBytes := strconv.AppendInt(IntBytes, 255, 16)
	fmt.Println(new_IntBytes)
}

运行go文件,得到输出:

[102 102]

全栈后端 / go语法 :













Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.