StrInsert

Table of Contents

StrInsert

Description

Insert contents of str2 into str at given index.

Parameters

NameDirectionDescription
strin,outStr object to insert into.
str2inStr object to be inserted.
idxinIndex to insert at.

Success

return

Failure

Does not return

Usage example (Cross-references)

    // Test StrInsert function
    bool test_str_insert(void) {
    printf("Testing StrInsert\n");
    
    Str s1 = StrInitFromZstr("Hello");
    
    // Insert s2 into s1 in the middle
    StrInsert(&s1, &s2, 2);
    
    // Check that the string was inserted correctly

Share :