StrEndsWithZstr
- Function
- October 8, 2025
Table of Contents
StrEndsWithZstr
StrEndsWithZstrDescription
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)
- In
Str.c:199:
}
bool StrEndsWithZstr(const Str *s, const char *suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix, ZstrLen(suffix));
- In
Str.Ops.c:109:
// Test StrEndsWithZstr
result = result && StrEndsWithZstr(&s, "World");
result = result && !StrEndsWithZstr(&s, "Hello");
- In
Str.Ops.c:110:
// Test StrEndsWithZstr
result = result && StrEndsWithZstr(&s, "World");
result = result && !StrEndsWithZstr(&s, "Hello");
// Test StrStartsWithCstr
- In
Main.c:10:
// Use the fixed VecForeachPtr macro
VecForeachPtr(&lines, line) {
if (StrStartsWithZstr(line, "[.") && StrEndsWithZstr(line, "]")) {
Str rule_name = StrInit();
StrReadFmt(line->data, "[.{}]", rule_name);