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 Golang : Spell checking with ispell example
+22.6k Golang : Daemonizing a simple web server process example
+11.6k Golang : http.Get example
+4.7k Javascript : How to refresh page with JQuery ?
+8.2k Golang : How to generate Code 39 barcode?
+14.3k Golang : Loop each day of the current month example
+14.1k Golang : How to add color to string?
+3.9k Fix Google Analytics Redundant Hostnames problem
+13.3k Golang : Submit web forms without browser by http.PostForm example
+32.6k Golang : Proper way to set function argument default value
+4.6k Golang : Get S3 or CloudFront object or file information
+11.3k Golang : zlib compress file example