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
+23.4k Golang : Get ASCII code from a key press(cross-platform) example
+8.1k Golang : Randomize letters from a string example
+6.9k Golang : constant 20013 overflows byte error message
+11.5k Golang : Fuzzy string search or approximate string matching example
+8.1k How to show different content from website server when AdBlock is detected?
+12.1k Golang : Pagination with go-paginator configuration example
+37.4k Upload multiple files with Go
+16.8k Golang : How to generate QR codes?
+14.3k Golang : Recombine chunked files example
+9.7k Golang : Qt get screen resolution and display on center example
+21.6k SSL : How to check if current certificate is sha1 or sha2
+16.5k Golang : File path independent of Operating System