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
+5.5k Linux/Unix/PHP : Restart PHP-FPM
+4.6k Golang : PGX CopyFrom to insert rows into Postgres database
+6.6k Mac/Linux/Windows : Get CPU information from command line
+48.2k Golang : Upload file from web browser to server
+18.2k Golang : Find IP address from string
+5.2k Gogland : Datasource explorer
+23.7k Golang : Call function from another package
+15.8k Golang : Loop each day of the current month example
+7.9k Golang : Add build version and other information in executables
+19.3k Golang : Set or Add HTTP Request Headers
+30.1k Get client IP Address in Go
+7k Golang : Calculate how many weeks left to go in a given year