StrStartsWithCstr
- Function
- August 22, 2025
Table of Contents
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)
- In
Str.c:203
:
}
bool StrStartsWithCstr(const Str* s, const char* prefix, size prefix_len) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix, prefix_len);
- In
Str.Ops.c:113
:
// Test StrStartsWithCstr
result = result && StrStartsWithCstr(&s, "Hell", 4);
result = result && !StrStartsWithCstr(&s, "Worl", 4);
- In
Str.Ops.c:114
:
// Test StrStartsWithCstr
result = result && StrStartsWithCstr(&s, "Hell", 4);
result = result && !StrStartsWithCstr(&s, "Worl", 4);
// Test StrEndsWithCstr