StrEndsWithCstr

Table of Contents

StrEndsWithCstr

Description

Check if string ends with a fixed-length C-style string (Cstr).

Parameters

NameDirectionDescription
sinStr to check.
suffixinPointer to suffix character array.
suffix_leninLength of suffix.

Success

Returns true if s ends with suffix.

Failure

Returns false.

Usage example (Cross-references)

    }
    
    bool StrEndsWithCstr(const Str* s, const char* suffix, size suffix_len) {
    ValidateStr(s);
    return ends_with(s->data, s->length, suffix, suffix_len);
    
    // Test StrEndsWithCstr
    result = result && StrEndsWithCstr(&s, "orld", 4);
    result = result && !StrEndsWithCstr(&s, "ello", 4);
    // Test StrEndsWithCstr
    result = result && StrEndsWithCstr(&s, "orld", 4);
    result = result && !StrEndsWithCstr(&s, "ello", 4);
    
    StrDeinit(&s);

Share :