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
+51.5k Golang : Check if item is in slice/array
+36.2k Golang : Integer is between a range
+6.7k Golang : Embedded or data bundling example
+18k Golang : Simple client server example
+6.5k Golang : Break string into a slice of characters example
+9k Android Studio : Image button and button example
+23.1k Golang : Test file read write permission example
+35.3k Golang : Upload and download file to/from AWS S3
+14.4k Golang : Get uploaded file name or access uploaded files
+7.9k Golang : Regular Expression find string example
+4.9k Golang : How to pass data between controllers with JSON Web Token