GO語言"strconv"包中"FormatUint"函數的用法及代碼示例。
用法:
func FormatUint(i uint64, base int) string
FormatUint 返回 i 在給定基數中的字符串表示形式,即 2 <= base <= 36。結果使用小寫字母 'a' 到 'z' 表示數字值 >= 10。
例子:
package main
import (
"fmt"
"strconv"
)
func main() {
v := uint64(42)
s10 := strconv.FormatUint(v, 10)
fmt.Printf("%T, %v\n", s10, s10)
s16 := strconv.FormatUint(v, 16)
fmt.Printf("%T, %v\n", s16, s16)
}
輸出:
string, 42 string, 2a
相關用法
- GO FormatMediaType用法及代碼示例
- GO FormatBool用法及代碼示例
- GO FormatFloat用法及代碼示例
- GO FormatInt用法及代碼示例
- GO Fscanln用法及代碼示例
- GO Float.SetString用法及代碼示例
- GO FileServer用法及代碼示例
- GO FieldsFunc用法及代碼示例
- GO Fprintln用法及代碼示例
- GO Float64s用法及代碼示例
- GO Fprintf用法及代碼示例
- GO Fprint用法及代碼示例
- GO Floor用法及代碼示例
- GO Float64sAreSorted用法及代碼示例
- GO Float.Scan用法及代碼示例
- GO FileMode用法及代碼示例
- GO FullRune用法及代碼示例
- GO FullRuneInString用法及代碼示例
- GO Float.Add用法及代碼示例
- GO Func用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 FormatUint。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。