62进制字符串转10进制数字
func Base62ToDec(str string) int64 {
base62 := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
base := int64(len(base62))
var result int64
for i, char := range str {
exp := len(str) - i - 1
index := strings.IndexByte(base62, byte(char))
result += int64(math.Pow(float64(base), float64(exp))) * int64(index)
}
return result
}
评论(0)