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
+24.1k Golang : Use regular expression to validate domain name
+62.9k Golang : Convert HTTP Response body to string
+6.2k PHP : How to check if an array is empty ?
+6.3k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+14.5k Golang : How to convert a number to words
+15.8k Golang : Get checkbox or extract multipart form data value example
+10.3k Golang : How to tokenize source code with text/scanner package?
+9.2k Golang : How to use Gorilla webtoolkit context package properly
+43.6k Golang : Convert []byte to image
+5.9k Javascript : How to replace HTML inside <div>?
+9.5k Golang : Web(Javascript) to server-side websocket example
+21.5k Golang : How to force compile or remove object files first before rebuild?