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.6k Android Studio : Indicate progression with ProgressBar example
+21.1k Golang : untar or extract tar ball archive example
+6.8k Golang : Scan files for certain pattern and rename part of the files
+13.2k Golang : Overwrite previous output with count down timer
+16.9k Golang : Get download file size
+23.9k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+7.3k Android Studio : Import third-party library or package into Gradle Scripts
+37.8k Golang : Remove dashes(or any character) from string
+8.8k Golang : Function wrapper that takes arguments and return result example
+8.4k Golang : Quadratic example
+28.1k Golang : Get time.Duration in year, month, week or day
+8.4k Golang : Convert(cast) string to int64