SS8_INSERT(3)                    Ssstr Manual                    SS8_INSERT(3)



NAME
       ss8_insert,  ss8_insert_cstr,  ss8_insert_bytes, ss8_insert_ch, ss8_in‐
       sert_ch_n - insert a string or characters at a  given  position  of  an
       ssstr byte string

SYNOPSIS
       #include <ss8str.h>

       ss8str *ss8_insert(ss8str *restrict dest, size_t pos,
                          ss8str const *restrict src);
       ss8str *ss8_insert_cstr(ss8str *restrict dest, size_t pos,
                          char const *restrict src);
       ss8str *ss8_insert_bytes(ss8str *restrict dest, size_t pos,
                          char const *restrict src, size_t srclen);
       ss8str *ss8_insert_ch(ss8str *dest, size_t pos, char ch);
       ss8str *ss8_insert_ch_n(ss8str *dest, size_t pos, char ch,
                          size_t count);

DESCRIPTION
       ss8_insert()  inserts  the  ss8str  at  src at byte position pos of the
       ss8str at dest.  Behavior is undefined unless dest  and  src  point  to
       valid  and distinct ss8str objects and pos is less than or equal to the
       length of the destination string.

       ss8_insert_cstr() inserts the null-terminated byte string src  at  byte
       position  pos of the ss8str at dest.  Behavior is undefined unless dest
       points to a valid ss8str object, pos is  less  than  or  equal  to  the
       length  of  the  destination  string, and src is a null-terminated byte
       string that does not overlap with the internal buffer of dest.

       ss8_insert_bytes() inserts the byte string of length srclen located  at
       src  at byte position pos of the ss8str at dest.  Behavior is undefined
       unless dest points to a valid ss8str object, pos is less than or  equal
       to the length of the destination string, and src is not NULL and points
       to an array of at least srclen bytes that does not overlap with the in‐
       ternal buffer of dest.

       ss8_insert_ch()  inserts the single byte ch at byte position pos of the
       ss8str at dest.  Behavior is undefined unless dest points  to  a  valid
       ss8str object and pos is less than or equal to the length of the desti‐
       nation string.

       ss8_insert_ch_n() inserts count copies of the byte ch at byte  position
       pos of the ss8str at dest.  Behavior is undefined unless dest points to
       a valid ss8str object and pos is less than or equal to  the  length  of
       the destination string.

RETURN VALUE
       All 5 functions return dest.

SEE ALSO
       ss8_cat(3), ss8_erase(3), ss8_replace(3), ssstr(7)



SSSTR                             2023-12-30                     SS8_INSERT(3)