Given, stringvalue := "zzzzzzzzzzzzzzzzzzzz"
i, err := strconv.ParseInt(stringvalue, 36, 0)
How do I return int128 as my stringvalue will be long enough to return int128?
Given, stringvalue := "zzzzzzzzzzzzzzzzzzzz"
i, err := strconv.ParseInt(stringvalue, 36, 0)
How do I return int128 as my stringvalue will be long enough to return int128?
There is no Go type int128
. Use the Go math/big
package type Int
.
For example,
package main
import (
"fmt"
"math/big"
)
func main() {
z, ok := new(big.Int).SetString("zzzzzzzzzzzzzzzzzzzz", 36)
if ok {
fmt.Println(z)
fmt.Println(z.Text(36))
}
}
Playground: https://play.golang.org/p/ln1PswhmK-l
Output:
13367494538843734067838845976575
zzzzzzzzzzzzzzzzzzzz