Skip to content

ZstrFindChar

Description

Find the first occurrence of a character in a null-terminated string.

Parameters

Name Direction Description
str in String to search in.
ch in Character to search for.

Success

Returns pointer to first occurrence or NULL if not found.

Failure

Function cannot fail if str is valid.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    char *ZstrFindChar(const char *str, char ch) {
        if (!str) {
            LOG_FATAL("Invalid arguments");
            }
    
            dot = ZstrFindChar(body, '.');
            if (!dot) {
                if (!StrPushBackCstr(&result, body, ZstrLen(body))) {
    
            // String should have expected decimal places
            char *dot_pos = ZstrFindChar(s.data, '.');
            if (dot_pos) {
                size_t 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(s.data, '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(s.data, 'E') != NULL);
            result     = result && has_E;
Last updated on