Skip to content

Commit

Permalink
feat: add safe parse big.Int
Browse files Browse the repository at this point in the history
  • Loading branch information
anhducpn67 committed Nov 13, 2024
1 parent 50ce753 commit ff2de9b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package kutils

import (
"math/big"
)

const LimitLength = 200

func SafeParseBigInt(s string, base int) (*big.Int, bool) {
if len(s) > LimitLength {
return nil, false
}
return new(big.Int).SetString(s, base)
}

0 comments on commit ff2de9b

Please sign in to comment.