SS8_REPLACE(3)                   Ssstr Manual                   SS8_REPLACE(3)



NAME
       ss8_replace,   ss8_replace_cstr,   ss8_replace_bytes,   ss8_replace_ch,
       ss8_replace_ch_n - replace a portion of an ssstr  byte  string  with  a
       string or characters

SYNOPSIS
       #include <ss8str.h>

       ss8str *ss8_replace(ss8str *restrict dest, size_t pos,
                           size_t len, ss8str const *restrict src);
       ss8str *ss8_replace_cstr(ss8str *restrict dest, size_t pos,
                           size_t len, char const *restrict src);
       ss8str *ss8_replace_bytes(ss8str *restrict dest, size_t pos,
                           size_t len, char const *restrict src,
                           size_t srclen);
       ss8str *ss8_replace_ch(ss8str *dest, size_t pos,
                           size_t len, char ch);
       ss8str *ss8_replace_ch_n(ss8str *dest, size_t pos,
                           size_t len, char ch, size_t count);

DESCRIPTION
       ss8_replace()  replaces the substring of the ss8str at dest starting at
       byte position start and having length up to len (limited by the  length
       of the destination string) with the contents of the ss8str at src.  Be‐
       havior 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 des‐
       tination string.

       ss8_replace_cstr() replaces the substring of the ss8str at dest  start‐
       ing  at  byte position start and having length up to len with the null-
       terminated byte string src.  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_replace_bytes() replaces the substring of the ss8str at dest start‐
       ing at byte position start and having length up to len  with  the  byte
       string  of  length srclen located at src.  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  internal
       buffer of dest.

       ss8_replace_ch()  replaces the substring of the ss8str at dest starting
       at byte position start and having length up to len with the single byte
       ch.   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.

       ss8_replace_ch_n() replaces the substring of the ss8str at dest  start‐
       ing  at  byte  position  start  and  having length up to len with count
       copies of the byte ch.  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_insert(3), ssstr(7)



SSSTR                             2023-12-30                    SS8_REPLACE(3)