nidus-sync/strings.go
Eli Ribble c0b527c9a3
Add cell debug page.
This makes it much easier to troubleshoot information related to a cell
by showing detailed data about a single cell. At this point much is a
placeholder, but we at least get the cell boundary coordinates and a
map.

This also starts to make some code common around doing things like
mapping.
2025-11-19 15:21:06 +00:00

34 lines
664 B
Go

package main
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
}