StrFindZstr

Table of Contents

StrFindZstr

Description

Find a key in a Str object.

Parameters

NameDirectionDescription
strinStr object to find str into.
keyinconst char* string to look for

Success

char* providing position of found string. Pointer is inside str.

Failure

NULL

Usage example (Cross-references)

    // Test string find functions
    bool test_str_find(void) {
    printf("Testing StrFindStr, StrFindZstr, and StrFindCstr\n");
    
    Str haystack = StrInitFromZstr("Hello World");
    
    // Test StrFindZstr
    const char* found4 = StrFindZstr(&haystack, "World");
    result             = result && (found4 != NULL && ZstrCompare(found4, "World") == 0);

Share :