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.1k Python : Delay with time.sleep() function example
+8.1k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+19.7k Android Studio : AlertDialog and EditText to get user string input example
+10.2k Golang : Get local time and equivalent time in different time zone
+5k Javascript : Shuffle or randomize array example
+7.3k Gogland : Where to put source code files in package directory for rookie
+8.4k Yum Error: no such table: packages
+4.6k Nginx and PageSpeed build from source CentOS example
+11.5k Golang : Clean formatting/indenting or pretty print JSON result
+13.5k Golang : convert rune to unicode hexadecimal value and back to rune character
+17.6k Golang : How to remove certain lines from a file
+6.8k Golang : Of hash table and hash map