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
+15.1k Golang : How to get Unix file descriptor for console and file
+19.1k Golang : Populate dropdown with html/template example
+5.8k Facebook : How to force facebook to scrape latest URL link data?
+13.3k Golang : Verify token from Google Authenticator App
+10.6k Golang : Get currencies exchange rates example
+11.3k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+8k Golang : Multiplexer with net/http and map
+10.9k Golang : Create S3 bucket with official aws-sdk-go package
+10.6k Android Studio : Checkbox for user to select options example
+7.2k Golang : Example of custom handler for Gorilla's Path usage.
+20k Golang : Convert seconds to human readable time format example