ZstrFindChar
Description
Find the first occurrence of a character in a null-terminated string.
Success
Returns pointer to first occurrence or NULL if not found.
Failure
Aborts via LOG_FATAL when str is NULL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.c:482:
if (is_long) {
eq = ZstrFindChar(tok, '=');
if (eq) {
inline_v = eq + 1;- In
Io.c:1396:
}
dot = ZstrFindChar(body, '.');
if (!dot) {
if (!StrPushBackMany(&result, body, ZstrLen(body))) {- In
Zstr.c:134:
}
Zstr ZstrFindChar(Zstr str, char ch) {
if (!str) {
LOG_FATAL("Invalid arguments");
// String should have expected decimal places
Zstr dot_pos = ZstrFindChar(StrBegin(&s), '.');
if (dot_pos) {
size decimal_places = ZstrLen(dot_pos + 1); StrFloatFormat config = {.precision = 3, .force_sci = true, .uppercase = false};
StrFromF64(&s, sci_values[i], &config);
bool has_e = (ZstrFindChar(StrBegin(&s), 'e') != NULL);
result = result && has_e; config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = true};
StrFromF64(&s, sci_values[i], &config);
bool has_E = (ZstrFindChar(StrBegin(&s), 'E') != NULL);
result = result && has_E;
Last updated on