StrSplitToIters
- Function
- August 22, 2025
Table of Contents
StrSplitToIters
StrSplitToIters
Description
Split given string into multiple StrIter into the same string. This way the split operation can be performed without creating new strings, but instead just having an iterated view into the Str object. This is best used when user never needs to make modifications and save the modifications. In other words, best used when only need iteration over string with some delimiters.
Parameters
Name | Direction | Description |
---|---|---|
str | in | Str object to split |
key | in | Zero-terminated char pointer value to split based on |
Success
StrIters vector of non-zero length
Failure
StrIters vector of zero-length
Usage example (Cross-references)
- In
Str.c:92
:
}
StrIters StrSplitToIters(Str* s, const char* key) {
ValidateStr(s);
- In
Str.Ops.c:163
:
// Test string split functions
bool test_str_split(void) {
printf("Testing StrSplit and StrSplitToIters\n");
// Test StrSplit
- In
Str.Ops.c:179
:
// Test StrSplitToIters
StrIters iters = StrSplitToIters(&s, ",");
result = result && (iters.length == 3);