fun parseAsAddress()

in src/main/kotlin/com/github/mkartashev/hserr/Utils.kt [40:51]


fun parseAsAddress(s: String): ULong? {
    try {
        return if (s.startsWith("0x") || s.startsWith("00")) {
            s.substring(2).toULong(16)
        } else {
            s.toULong()
        }
    } catch (ignored: NumberFormatException) {
    }
    // May still be a hexadecimal number, but without the 0x prefix
    return s.toULongOrNull(16)
}