Skip to content
StrEndsWithZstr

StrEndsWithZstr

StrEndsWithZstr

Description

Check if string ends with a null-terminated string (Zstr).

Parameters

Name Direction Description
s in Str to check.
suffix in Null-terminated suffix string.

Success

Returns true if s ends with suffix.

Failure

Returns false.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool StrEndsWithZstr(const Str *s, const char *suffix) {
        ValidateStr(s);
        return ends_with(s->data, s->length, suffix, ZstrLen(suffix));
            // Use the fixed VecForeachPtr macro
            VecForeachPtr(&lines, line) {
                if (StrStartsWithZstr(line, "[.") && StrEndsWithZstr(line, "]")) {
                    Str rule_name = StrInit();
                    StrReadFmt(line->data, "[.{}]", rule_name);
    
        // Test StrEndsWithZstr
        result = result && StrEndsWithZstr(&s, "World");
        result = result && !StrEndsWithZstr(&s, "Hello");
        // Test StrEndsWithZstr
        result = result && StrEndsWithZstr(&s, "World");
        result = result && !StrEndsWithZstr(&s, "Hello");
    
        // Test StrStartsWithCstr
Last updated on