IntTryFromStr
Description
Parse a decimal string into an integer. An optional leading + is accepted.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:352:
}
if (!IntTryFromStr(&result.significand, digits.data)) {
goto fail;
}- In
Int.c:505:
}
bool IntTryFromStr(Int *out, const char *decimal) {
u64 start = 0;- In
Int.c:523:
Int out = IntInit();
(void)IntTryFromStr(&out, decimal);
return out;
} Int parsed = IntFromStr("12x3");
Int value = IntInit();
bool result = !IntTryFromStr(&value, "12x3");
result = result && IntIsZero(&parsed); Int parsed = IntFromStr(NULL);
Int value = IntInit();
bool result = !IntTryFromStr(&value, NULL);
result = result && IntIsZero(&parsed);
Last updated on