Skip to content
StrStartsWithCstr

StrStartsWithCstr

StrStartsWithCstr

Description

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

Parameters

Name Direction Description
s in Str to check.
prefix in Pointer to prefix character array.
prefix_len in Length of prefix.

Success

Returns true if s starts with prefix.

Failure

Returns false.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool StrStartsWithCstr(const Str *s, const char *prefix, size prefix_len) {
        ValidateStr(s);
        return starts_with(s->data, s->length, prefix, prefix_len);
    
        // Test StrStartsWithCstr
        result = result && StrStartsWithCstr(&s, "Hell", 4);
        result = result && !StrStartsWithCstr(&s, "Worl", 4);
        // Test StrStartsWithCstr
        result = result && StrStartsWithCstr(&s, "Hell", 4);
        result = result && !StrStartsWithCstr(&s, "Worl", 4);
    
        // Test StrEndsWithCstr
Last updated on