openethereum-node-status/pkg/util/hex2int.go

13 lines
209 B
Go

package util
import (
"strconv"
"strings"
)
func Hex2Int(hexStr string) uint64 {
cleaned := strings.Replace(hexStr, "0x", "", -1)
result, _ := strconv.ParseUint(cleaned, 16, 64)
return uint64(result)
}