ZstrLen
- Function
- October 8, 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:74
:
}
size ZstrLen(const char *str) {
if (!str) {
LOG_FATAL("Invalid arguments");
- In
Memory.c:140
:
char *ZstrDup(const char *src) {
return ZstrDupN(src, ZstrLen(src));
}
- In
Memory.c:197
:
// Calculate haystack length
size haystack_len = ZstrLen(haystack);
// if needle is longer than haystack, is it really a needle?
- In
Io.c:427
:
const char *p = fmtstr;
const char *in = input;
u64 rem_p = ZstrLen(fmtstr);
u64 rem_in = ZstrLen(in);
u64 arg_index = 0; // Current argument index
- In
Io.c:428
:
const char *in = input;
u64 rem_p = ZstrLen(fmtstr);
u64 rem_in = ZstrLen(in);
u64 arg_index = 0; // Current argument index
- In
Io.c:940
:
} else {
// Get string length
size len = ZstrLen(xs);
// If precision is specified, use it as max length
- In
Str.c:97
:
StrIters sv = VecInit();
size keylen = ZstrLen(key);
const char *prev = s->data;
- In
Str.c:122
:
Strs sv = VecInitWithDeepCopy(NULL, StrDeinit);
size keylen = ZstrLen(key);
const char *prev = s->data;
- In
Str.c:196
:
bool StrStartsWithZstr(const Str *s, const char *prefix) {
ValidateStr(s);
return starts_with(s->data, s->length, prefix, ZstrLen(prefix));
}
- In
Str.c:201
:
bool StrEndsWithZstr(const Str *s, const char *suffix) {
ValidateStr(s);
return ends_with(s->data, s->length, suffix, ZstrLen(suffix));
}
- In
Str.c:245
:
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)
- In
VecStr.c:430
:
size_t total_len = 0;
VecForeach(vec, str) {
total_len += ZstrLen(str.data);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:474
:
size_t total_len = 0;
VecForeachReverse(vec, str) {
total_len += ZstrLen(str.data);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:485
:
size_t total_len = 0;
VecForeachReverseIdx(vec, str, idx) {
total_len += ZstrLen(str.data) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:496
:
size_t total_len = 0;
VecForeachPtrReverse(vec, str_ptr) {
total_len += ZstrLen(str_ptr->data);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:507
:
size_t total_len = 0;
VecForeachPtrReverseIdx(vec, str_ptr, idx) {
total_len += ZstrLen(str_ptr->data) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:521
:
size_t total_len = 0;
VecForeachInRange(vec, str, start, end) {
total_len += ZstrLen(str.data);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:536
:
size_t total_len = 0;
VecForeachInRangeIdx(vec, str, idx, start, end) {
total_len += ZstrLen(str.data) + idx;
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:551
:
size_t total_len = 0;
VecForeachPtrInRange(vec, str_ptr, start, end) {
total_len += ZstrLen(str_ptr->data);
}
(void)total_len; // Suppress unused variable warning
- In
VecStr.c:566
:
size_t total_len = 0;
VecForeachPtrInRangeIdx(vec, str_ptr, idx, start, end) {
total_len += ZstrLen(str_ptr->data) + idx;
}
(void)total_len; // Suppress unused variable warning