StrEndsWith

Table of Contents

StrEndsWith

Description

Check if string ends with another Str object.

Parameters

NameDirectionDescription
sinStr to check.
suffixinStr to check as suffix.

Success

Returns true if s ends with suffix.

Failure

Returns false.

Usage example (Cross-references)

    }
    
    bool StrEndsWith(const Str* s, const Str* suffix) {
    ValidateStr(s);
    return ends_with(s->data, s->length, suffix->data, suffix->length);
    // Test string starts/ends with functions
    bool test_str_starts_ends_with(void) {
    printf("Testing StrStartsWith and StrEndsWith variants\n");
    
    Str s      = StrInitFromZstr("Hello World");
    
    // Test StrEndsWith
    result = result && StrEndsWith(&s, &suffix);
    
    // Test StrStartsWithZstr

Share :