nidus-sync/sync/strings.go
Eli Ribble 9774452821 Switch main report page to better example
This is still pulling from our generic district mock, but it's still
better than what we had. This also includes adding static content
hosting for the bootstrap content on the public domain.
2026-01-07 20:47:55 +00:00

34 lines
664 B
Go

package sync
import (
"strconv"
"strings"
)
func HexToInt64(hexStr string) (int64, error) {
// Remove "0x" prefix if present
hexStr = strings.TrimPrefix(hexStr, "0x")
hexStr = strings.TrimPrefix(hexStr, "0X")
// Parse hex string to uint64
value, err := strconv.ParseInt(hexStr, 16, 64)
if err != nil {
return 0, err
}
return value, nil
}
func HexToUint64(hexStr string) (uint64, error) {
// Remove "0x" prefix if present
hexStr = strings.TrimPrefix(hexStr, "0x")
hexStr = strings.TrimPrefix(hexStr, "0X")
// Parse hex string to uint64
value, err := strconv.ParseUint(hexStr, 16, 64)
if err != nil {
return 0, err
}
return value, nil
}