Skip to content

StrRemove

Description

Remove the character at idx and optionally store it; trailing characters shift one slot to the left. Pass NULL for chr to discard. idx must lie in [0, length). See VecRemove for the full SUCCESS/FAILURE contract.

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrRemove function
    bool test_str_remove(void) {
        WriteFmt("Testing StrRemove\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
        // Remove a character from the middle
        char c;
        StrRemove(&s, &c, 2);
    
        // Check that the character was removed correctly
        // Remove another character without storing it - avoid passing NULL directly
        char ignored;
        StrRemove(&s, &ignored, 1);
    
        // Check that the character was removed
Last updated on