Skip to content
ZstrFindSubstringN

ZstrFindSubstringN

ZstrFindSubstringN

Description

Find first occurrence of a substring of specified length in haystack.

Parameters

Name Direction Description
haystack in String to search in.
needle in Substring to search for.
needle_len in Length of the substring to search for.

Success

Returns pointer to first occurrence or NULL if not found.

Failure

Returns NULL if haystack is invalid or needle is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    char *ZstrFindSubstringN(const char *haystack, const char *needle, size needle_len) {
        if (!haystack || !needle) {
            LOG_FATAL("Invalid arguments");
                        // Find first occurence of content between current and next format specifier or null character
                        const char *e = NULL;
                        if ((e = ZstrFindSubstringN(in, p, space_len))) {
                            fmt_info.max_read_len = e - in;
                        }
    /// FAILURE : NULL
    ///
    #define StrFindCstr(str, key, key_len) ZstrFindSubstringN((str)->data, (key), (key_len))
    
        //
Last updated on