Skip to content

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)
    
        if (is_long) {
            eq = ZstrFindChar(tok, '=');
            if (eq) {
                inline_v = eq + 1;
            }
    
            dot = ZstrFindChar(body, '.');
            if (!dot) {
                if (!StrPushBackMany(&result, body, ZstrLen(body))) {
    }
    
    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