GO語言"strconv"包中"AppendInt"函數的用法及代碼示例。
用法:
func AppendInt(dst []byte, i int64, base int) []byte
AppendInt 將由 FormatInt 生成的整數 i 的字符串形式附加到 dst 並返回擴展緩衝區。
例子:
package main
import (
"fmt"
"strconv"
)
func main() {
b10 := []byte("int (base 10):")
b10 = strconv.AppendInt(b10, -42, 10)
fmt.Println(string(b10))
b16 := []byte("int (base 16):")
b16 = strconv.AppendInt(b16, -42, 16)
fmt.Println(string(b16))
}
輸出:
int (base 10):-42 int (base 16):-2a
相關用法
- GO AppendRune用法及代碼示例
- GO AppendQuoteRune用法及代碼示例
- GO AppendBool用法及代碼示例
- GO AppendQuoteToASCII用法及代碼示例
- GO AppendFloat用法及代碼示例
- GO AppendQuoteRuneToASCII用法及代碼示例
- GO AppendQuote用法及代碼示例
- GO AppendUint用法及代碼示例
- GO Atan2用法及代碼示例
- GO Atan用法及代碼示例
- GO Acos用法及代碼示例
- GO Acosh用法及代碼示例
- GO Asinh用法及代碼示例
- GO As用法及代碼示例
- GO Asin用法及代碼示例
- GO Atoi用法及代碼示例
- GO Add32用法及代碼示例
- GO Add64用法及代碼示例
- GO After用法及代碼示例
- GO Atanh用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 AppendInt。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。