Skip to content

StrEndsWith

StrEndsWith

Description

Check if string ends with another Str object.

Parameters

Name Direction Description
s in Str to check.
suffix in Str to check as suffix.

Success

Returns true if s ends with suffix.

Failure

Returns false.

Usage example (Cross-references)

Usage examples (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) {
        WriteFmt("Testing StrStartsWith and StrEndsWith variants\n");
    
        Str s      = StrInitFromZstr("Hello World");
    
        // Test StrEndsWith
        result = result && StrEndsWith(&s, &suffix);
    
        // Test StrStartsWithZstr
Last updated on