StrEndsWith
- Function
- August 22, 2025
Table of Contents
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)
- In
Str.c:218
:
}
bool StrEndsWith(const Str* s, const Str* suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix->data, suffix->length);
- In
Str.Ops.c:92
:
// Test string starts/ends with functions
bool test_str_starts_ends_with(void) {
printf("Testing StrStartsWith and StrEndsWith variants\n");
Str s = StrInitFromZstr("Hello World");
- In
Str.Ops.c:102
:
// Test StrEndsWith
result = result && StrEndsWith(&s, &suffix);
// Test StrStartsWithZstr