StrToBig
Converts a string representation of a number to a big.Int.
Function Signature
func StrToBig(str string) *big.IntSource: keccak.go
Parameters
str- The string to convert to a*big.Int(numeric string representation)
Returns
*big.Int- A pointer to a big.Int representing the converted value
Usage Example
package main
import (
"fmt"
"github.com/NethermindEth/starknet.go/utils"
)
func main() {
// Convert numeric string to big.Int
numStr := "123456789012345678901234567890"
bigInt := utils.StrToBig(numStr)
fmt.Printf("String: %s\n", numStr)
fmt.Printf("Big Int: %s\n", bigInt.String())
fmt.Printf("Type: %T\n", bigInt)
// Output:
// String: 123456789012345678901234567890
// Big Int: 123456789012345678901234567890
// Type: *big.Int
}Common Use Cases
- Converting numeric config values to
big.Int. - Parsing large numbers from JSON responses.
- Handling fee amounts that exceed standard integer limits.
- Processing large token quantities with high decimal precision.
See Also
- Type Conversions for parsing numeric strings in various formats

