Skip to content

StrLast

StrLast

Description

Access last character in string

Usage example (Cross-references)

Usage examples (Cross-references)
            case STR_LAST : {
                if (VecLen(str) > 0) {
                    char last = StrLast(str);
                    (void)last; // Suppress unused variable warning
                }
    // Test StrLast function
    bool test_str_last(void) {
        WriteFmt("Testing StrLast\n");
    
        Str s = StrInitFromZstr("Hello");
    
        // Get the last character
        char last = StrLast(&s);
    
        // Check that the character is correct
Last updated on