StrEndsWithZstr

Table of Contents

StrEndsWithZstr

Description

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

Parameters

NameDirectionDescription
sinStr to check.
suffixinNull-terminated suffix string.

Success

Returns true if s ends with suffix.

Failure

Returns false.

Usage example (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

Share :