Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 775 Bytes

AppendInt.md

File metadata and controls

31 lines (21 loc) · 775 Bytes

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

参数列表

  • dst 表示原列表
  • i 表示需要添加的int64值
  • base 表示进制数 2 <= base <= 36

返回值:

  • 返回[]byte 表示原列表添加数值后新生成的列表

功能说明:

  • 类似AppendFloat,只能追加int类型,base表示int表示的进制数,返回追加后的 []byte。当进制大于10时,大于10的值将使用小写a-z表示。

代码实例:

package main

import (
    "fmt"
    "strconv"
)

func main() {
    newlist := strconv.AppendInt(make([]byte, 0), 123000, 10)
    fmt.Println(newlist) //[49 50 51 48 48 48]
    newlist = strconv.AppendInt(make([]byte, 0), 8, 2)
    fmt.Println(newlist) //[49 48 48 48]
}