diff --git a/str.go b/str.go index a5a84a6..e0c8431 100644 --- a/str.go +++ b/str.go @@ -126,3 +126,11 @@ func GetEnvDefault(key, defval string) string { return defval } } + +// fix hex string to no 0x prefix +func FixToNo0x(hexstr string) string { + if strings.HasPrefix(hexstr, "0x") { + return hexstr[2:] + } + return hexstr +}