StrIterLength
Description
Total character length of the region the StrIter covers. Alias- reframe of IterLength in string vocabulary. See IterLength for the full contract.
Parameters
| Name | Direction | Description |
|---|---|---|
mi |
in | Pointer to the StrIter to measure. |
Success
Returns the total character length of the covered region.
Failure
Macro cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.c:93:
}
// No digits consumed (cursor at entry) or trailing junk after digits.
if (StrIterRemainingLength(&si) == StrIterLength(&si) || StrIterRemainingLength(&si) != 0)
return false;
if (v > hi)- In
ProcMaps.c:154:
out->path = (Zstr)StrIterDataAt(si, path_start_pos); // may be empty if anonymous
if (line_terminator_pos < StrIterLength(si) && *StrIterDataAt(si, line_terminator_pos) == '\n') {
// intentional bypass: in-place mutation of the iter's backing
// buffer to NUL-terminate the path slice we just exposed via
- In
Ops.c:230:
StrIter *iter1 = VecPtrAt(&iters, 0);
char buffer1[10] = {0};
MemCopy(buffer1, iter1->data, StrIterLength(iter1));
result = result && (ZstrCompare(buffer1, "Hello") == 0);- In
Ops.c:235:
StrIter *iter2 = VecPtrAt(&iters, 1);
char buffer2[10] = {0};
MemCopy(buffer2, iter2->data, StrIterLength(iter2));
result = result && (ZstrCompare(buffer2, "World") == 0);- In
Ops.c:240:
StrIter *iter3 = VecPtrAt(&iters, 2);
char buffer3[10] = {0};
MemCopy(buffer3, iter3->data, StrIterLength(iter3));
result = result && (ZstrCompare(buffer3, "Test") == 0);
}- In
Ops.c:490:
bool result = (VecLen(&iters) == 3);
if (VecLen(&iters) == 3) {
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);- In
Ops.c:491:
if (VecLen(&iters) == 3) {
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);
}- In
Ops.c:492:
result = result && (StrIterLength(VecPtrAt(&iters, 0)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 1)) == 1);
result = result && (StrIterLength(VecPtrAt(&iters, 2)) == 0);
} Str out = StrInit(&alloc);
StrIter r = JReadString(si, &out);
if (StrIterIndex(&r) == StrIterIndex(&si) || StrIterIndex(&r) != StrIterLength(&r)) {
WriteFmtLn("[DEBUG] JReadString failed on a plain string: idx={}", StrIterIndex(&r));
success = false; success = false;
}
if (StrIterIndex(&si) != StrIterLength(&si)) {
WriteFmtLn(
"[DEBUG] iterator did not consume whole object: idx={}, len={}", "[DEBUG] iterator did not consume whole object: idx={}, len={}",
StrIterIndex(&si),
StrIterLength(&si)
);
success = false;- In
Parse.c:114:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 2);
result = result && KvConfigGetI64(&cfg, "a", &a) && (a == 1);- In
Parse.c:205:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 2);
result = result && KvConfigGetI64(&cfg, "a", &a) && (a == 1);- In
Parse.c:252:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 1);
v = KvConfigGetPtr(&cfg, "k");- In
Parse.c:277:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 1);
v = KvConfigGetPtr(&cfg, "k");- In
Parse.c:299:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 1);
result = result && KvConfigContains(&cfg, "k");- In
Parse.c:325:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 3);
result = result && KvConfigContains(&cfg, "host");- In
Parse.c:359:
bool result = true;
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 4);
result = result && path && StrCmp(path, "/srv/my app") == 0;- In
Parse.c:612:
name = KvConfigGetPtr(&cfg, "name");
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 3);
// The CR must not survive in the parsed value.
Last updated on