IntTryFromHexStr
Description
Parse a hexadecimal string into an integer. This parser expects hexadecimal digits only and does not accept a 0x prefix.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:642:
}
bool IntTryFromHexStr(Int *out, const char *hex) {
if (!out || !hex) {
LOG_ERROR("Invalid arguments");- In
Int.c:654:
Int out = IntInit();
(void)IntTryFromHexStr(&out, hex);
return out;
} Int parsed = IntFromHexStr("12g3");
Int value = IntInit();
bool result = !IntTryFromHexStr(&value, "12g3");
result = result && IntIsZero(&parsed); Int parsed = IntFromHexStr(NULL);
Int value = IntInit();
bool result = !IntTryFromHexStr(&value, NULL);
result = result && IntIsZero(&parsed);
Last updated on