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
+8.9k Golang : Find network service name from given port and protocol
+7.5k Golang : Process json data with Jason package
+12.1k Golang : Sort and reverse sort a slice of runes
+8.6k Golang : Convert(cast) []byte to io.Reader type
+32.2k Golang : Convert []string to []byte examples
+7.9k Javascript : How to check a browser's Do Not Track status?
+19.5k Golang : Fix cannot download, $GOPATH not set error
+12.7k Golang : Drop cookie to visitor's browser and http.SetCookie() example
+6.8k Golang : Find the longest line of text example
+10.2k Golang : Bcrypting password
+5.6k PHP : Convert string to timestamp or datestamp before storing to database(MariaDB/MySQL)