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.7k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+8.9k Facebook : Getting the friends list with PHP return JSON format
+6.6k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+15.6k Golang : How to check if input from os.Args is integer?
+13.1k Golang : Get dimension(width and height) of image file
+11.5k Golang : Simple client-server HMAC authentication without SSL example
+8.9k Golang : How to get garbage collection data?
+22.2k Golang : Strings to lowercase and uppercase example
+31.6k Golang : Copy directory - including sub-directories and files
+17.1k Golang : Upload/Receive file progress indicator
+9.8k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+18.8k Golang : Get current URL example