ZstrLen
- Function
- August 22, 2025
Table of Contents
ZstrLen
ZstrLen
Description
Get length of a null-terminated string.
Parameters
Name | Direction | Description |
---|---|---|
str | in | Null-terminated string. |
Success
Returns number of characters before null terminator.
Failure
Function cannot fail if str is valid.
Usage example (Cross-references)
- In
Memory.c:73
:
}
size ZstrLen(const char* str) {
if (!str) {
LOG_FATAL("Invalid arguments");
- In
Memory.c:138
:
char* ZstrDup(const char* src) {
return ZstrDupN(src, ZstrLen(src));
}
- In
Memory.c:179
:
// Calculate haystack length
size haystack_len = ZstrLen(haystack);
// Search through haystack
- In
Io.c:402
:
const char* p = fmtstr;
const char* in = input;
size remaining = ZstrLen(fmtstr);
size arg_index = 0; // Current argument index
- In
Io.c:880
:
} else {
// Get string length
size len = ZstrLen(xs);
// If precision is specified, use it as max length
- In
Str.c:96
:
StrIters sv = VecInit();
size keylen = ZstrLen(key);
const char* prev = s->data;
- In
Str.c:121
:
Strs sv = VecInitWithDeepCopy(NULL, StrDeinit);
size keylen = ZstrLen(key);
const char* prev = s->data;
- In
Str.c:195
:
bool StrStartsWithZstr(const Str* s, const char* prefix) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix, ZstrLen(prefix));
}
- In
Str.c:200
:
bool StrEndsWithZstr(const Str* s, const char* suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix, ZstrLen(suffix));
}
- In
Str.c:244
:
void StrReplaceZstr(Str* s, const char* match, const char* replacement, size count) {
ValidateStr(s);
str_replace(s, match, ZstrLen(match), replacement, ZstrLen(replacement), count);
}
- In
Vec.Complex.c:25
:
// Copy name
if (src->name) {
size name_len = ZstrLen(src->name);
dst->name = malloc(name_len + 1);
if (!dst->name)