add FixToNo0x

This commit is contained in:
bryanqiu 2023-01-30 09:33:07 +08:00
parent e21dbcc61b
commit 6e98ac9100

8
str.go
View File

@ -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
}