Skip to content

StrPushFrontR

Description

R-form sibling of StrPushFrontL.

Success

Returns true; the character is prepended at the head.

Failure

Returns false on allocation failure. str unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
        if (align == ALIGN_RIGHT) {
            for (size i = 0; i < pad_len; i++) {
                if (!StrPushFrontR(o, ' ')) {
                    return false;
                }
    
            for (size i = 0; i < left_pad; i++) {
                if (!StrPushFrontR(o, ' ')) {
                    return false;
                }
                        }
                        if (StrLen(&hex) == 1) {
                            if (!StrPushFrontR(&hex, '0')) {
                                return false;
                            }
                        }
                        if (StrLen(&hex) == 1) {
                            if (!StrPushFrontR(&hex, '0')) {
                                return false;
                            }
    
        // Push characters at the front
        StrPushFrontR(&s, ' ');
        StrPushFrontR(&s, 'o');
        StrPushFrontR(&s, 'l');
        // Push characters at the front
        StrPushFrontR(&s, ' ');
        StrPushFrontR(&s, 'o');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, ' ');
        StrPushFrontR(&s, 'o');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'e');
        StrPushFrontR(&s, 'o');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'e');
        StrPushFrontR(&s, 'H');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'e');
        StrPushFrontR(&s, 'H');
        StrPushFrontR(&s, 'l');
        StrPushFrontR(&s, 'e');
        StrPushFrontR(&s, 'H');
    
        // Check that the characters were inserted correctly
Last updated on