Convert a bigint to a string in Go

后端 未结 3 1089
不知归路
不知归路 2021-02-13 18:25

How do one convert a big int to a string (or integer) in Golang?

bigint := big.NewInt(123) //This is what I have
bigstr = \"123\" //This is what I want
         


        
3条回答
  •  离开以前
    2021-02-13 19:12

    Just use the String method : http://golang.org/pkg/math/big/#Int.String

    bigint := big.NewInt(123)
    bigstr := bigint.String()
    

提交回复
热议问题