StrForeachReverse
- Macro
- August 22, 2025
Table of Contents
StrForeachReverse
StrForeachReverse
Description
Iterate over each character chr
of the given Str str
in reverse order. This is a convenience macro that iterates backward using an internally managed index. The variable chr
is declared and defined by the underlying VecForeachReverse
macro.
Parameters
Name | Direction | Description |
---|---|---|
str | in,out | Str to iterate over. |
chr | in | Name of the variable to be used which will contain the character of the current element during iteration. The type of chr will likely be the character type used by the Str implementation (e.g., char ). |
Usage example (Cross-references)
// Test StrForeachReverse macro
bool test_str_foreach_reverse(void) {
printf("Testing StrForeachReverse\n");
Str s = StrInitFromZstr("Hello");
size char_count = 0;
StrForeachReverse(&s, chr, {
// Append the character to the result string
StrPushBack(&result, chr);