GO語言"strconv"包中"ParseUint"函數的用法及代碼示例。
用法:
func ParseUint(s string, base int, bitSize int)(uint64, error)
ParseUint 與 ParseInt 類似,但用於無符號數。
不允許使用符號前綴。
例子:
package main
import (
"fmt"
"strconv"
)
func main() {
v := "42"
if s, err := strconv.ParseUint(v, 10, 32); err == nil {
fmt.Printf("%T, %v\n", s, s)
}
if s, err := strconv.ParseUint(v, 10, 64); err == nil {
fmt.Printf("%T, %v\n", s, s)
}
}
輸出:
uint64, 42 uint64, 42
相關用法
- GO ParseAddress用法及代碼示例
- GO ParseIP用法及代碼示例
- GO ParseMediaType用法及代碼示例
- GO ParseInt用法及代碼示例
- GO ParseCIDR用法及代碼示例
- GO ParseInLocation用法及代碼示例
- GO ParseDuration用法及代碼示例
- GO ParseFile用法及代碼示例
- GO Parse用法及代碼示例
- GO ParseAddressList用法及代碼示例
- GO ParseBool用法及代碼示例
- GO ParseQuery用法及代碼示例
- GO ParseFloat用法及代碼示例
- GO ParsePKIXPublicKey用法及代碼示例
- GO PathUnescape用法及代碼示例
- GO PathEscape用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO PlainAuth用法及代碼示例
- GO Print用法及代碼示例
- GO Pow10用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 ParseUint。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。