Golang : Convert(cast) bigint to string
Problem :
You want to convert(cast) a big integer value to string for display.
Solution :
Use big.Int.String() function to convert the big integer value to string. For example :
package main
import (
"fmt"
"math/big"
)
func main() {
bigInt := big.NewInt(123456789)
bigStr := bigInt.String()
fmt.Println(bigStr)
}
Reference :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+6.6k Golang : Map within a map example
+6.6k Golang : Convert an executable file into []byte example
+17.5k Golang : Get future or past hours, minutes or seconds
+13.5k Golang : Count number of runes in string
+14.6k Golang : How to get URL port?
+6.6k Golang : How to validate ISBN?
+5.4k Golang : Reclaim memory occupied by make() example
+18k Golang : Get all upper case or lower case characters from string example
+6k Golang : Extract unicode string from another unicode string example
+7.4k Golang : Accessing dataframe-go element by row, column and name example
+36.4k Golang : Convert date or time stamp from string to time.Time type
+13.9k Golang : convert(cast) string to float value