Skip to content

StrInsertL

Description

Insert a single character into str at position idx, shifting trailing characters right. Three shapes:

StrInsertL(str, chr, idx) - L-form. chr must be a writeable char lvalue (VecInsertL zeroes it on success). Character literals ('x' – type int) cannot be used here; bind to a char first. StrInsertR(str, chr, idx) - R-form. chr may be a char lvalue or any value implicitly convertible to char (in particular, int character literals like 'x'). StrInsert(str, chr, idx) - Unsuffixed default = L-form.

Multi-character insertion is StrInsertMany (Zstr / Cstr), below. Merging another Str is StrMergeL / StrMergeR.

Success

Returns true; one character inserted; trailing characters shifted right by one.

Failure

Returns false on allocation failure. str unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
    #define StrInsertL(str, lval, idx) VecInsertL((str), (lval), (idx))
    #define StrInsertR(str, rval, idx) VecInsertR((str), (rval), (idx))
    #define StrInsert(str, val, idx)   StrInsertL((str), (val), (idx))
    
    ///
Last updated on