Skip to content
StrPushFrontMany

StrPushFrontMany

Description

Prepend MANY characters at the head of str. R-form. Two arities:

StrPushFrontMany(str, zstr) - 2 args; NUL-terminated. StrPushFrontMany(str, cstr, cstr_len) - 3 args; counted view.

Success

Returns true; bytes copied at the head; existing characters shifted right by the prepended length.

Failure

Returns false on allocation failure. str unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrPushFrontMany function
    bool test_str_push_front_cstr(void) {
        WriteFmt("Testing StrPushFrontMany\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        // Push a string at the front
        StrPushFrontMany(&s, "Hello ", 6);
    
        // Check that the string was inserted correctly
    // Test StrPushFrontMany function
    bool test_str_push_front_zstr(void) {
        WriteFmt("Testing StrPushFrontMany\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        // Push a string at the front
        StrPushFrontMany(&s, "Hello ");
    
        // Check that the string was inserted correctly
Last updated on