Skip to content

StrForeach

Description

Walk each character of str forward, binding chr to the current character value. Convenience wrapper around StrForeachIdx with an internally-managed index. See VecForeach for the full SUCCESS/FAILURE contract.

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrForeach macro
    bool test_str_foreach(void) {
        WriteFmt("Testing StrForeach\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
        // Build a new string by iterating through each character
        Str result = StrInit(&alloc);
        StrForeach(&s, chr) {
            // Append the character to the result string
            StrPushBackR(&result, chr);
Last updated on