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
+22.3k Golang : Set and Get HTTP request headers example
+4.5k Chrome : How to block socketloop.com links in Google SERP?
+5.4k Javascript : How to refresh page with JQuery ?
+13.1k Android Studio : Password input and reveal password example
+9.4k Golang : Detect number of active displays and the display's resolution
+38.8k Golang : How to read CSV file
+77.9k Golang : How to return HTTP status code?
+9.5k Golang : Qt get screen resolution and display on center example
+8.7k Golang : Get SPF and DMARC from email headers to fight spam
+5.2k Golang : fmt.Println prints out empty data from struct
+5k Golang : Print instead of building pyramids