add: hex2uint64 util

This commit is contained in:
2021-12-14 18:41:24 +03:00
parent b20ad7c443
commit 69202baadb
3 changed files with 18 additions and 5 deletions

12
pkg/util/hex2int.go Normal file
View File

@@ -0,0 +1,12 @@
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)
}