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
+7.3k Golang : Qt splash screen with delay example
+10.7k Golang : Concurrency and goroutine example
+7.4k Golang : Reverse text lines or flip line order example
+5.9k Golang : Skip or discard items of non-interest when iterating example
+3.4k Javascript : Empty an array example
+11.7k Golang : zlib compress file example
+13.4k Golang : How to determine if user agent is a mobile device example
+4.3k Golang : Display packages names during compilation
+4.6k Golang : Generate Interleaved 2 inch by 5 inch barcode
+13.3k Golang : How to check if your program is running in a terminal
+9.6k Android Studio : Checkbox for user to select options example
+5.2k Golang : Function as an argument type example