Skip to content

StrPopFront

Description

Remove the first character from the string and optionally store it. Trailing characters shift one slot to the left. Pass NULL for chr to discard. See VecPopFront for the full SUCCESS/FAILURE contract.

Usage example (Cross-references)

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