[4mSS8_REPLACE[24m(3) Ssstr Manual [4mSS8_REPLACE[24m(3)
[1mNAME[0m
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
[1mSYNOPSIS[0m
[1m#include <ss8str.h>[0m
[1mss8str *ss8_replace(ss8str *restrict [4m[22mdest[24m[1m, size_t [4m[22mpos[24m[1m,[0m
[1msize_t [4m[22mlen[24m[1m, ss8str const *restrict [4m[22msrc[24m[1m);[0m
[1mss8str *ss8_replace_cstr(ss8str *restrict [4m[22mdest[24m[1m, size_t [4m[22mpos[24m[1m,[0m
[1msize_t [4m[22mlen[24m[1m, char const *restrict [4m[22msrc[24m[1m);[0m
[1mss8str *ss8_replace_bytes(ss8str *restrict [4m[22mdest[24m[1m, size_t [4m[22mpos[24m[1m,[0m
[1msize_t [4m[22mlen[24m[1m, char const *restrict [4m[22msrc[24m[1m,[0m
[1msize_t [4m[22msrclen[24m[1m);[0m
[1mss8str *ss8_replace_ch(ss8str *[4m[22mdest[24m[1m, size_t [4m[22mpos[24m[1m,[0m
[1msize_t [4m[22mlen[24m[1m, char [4m[22mch[24m[1m);[0m
[1mss8str *ss8_replace_ch_n(ss8str *[4m[22mdest[24m[1m, size_t [4m[22mpos[24m[1m,[0m
[1msize_t [4m[22mlen[24m[1m, char [4m[22mch[24m[1m, size_t [4m[22mcount[24m[1m);[0m
[1mDESCRIPTION[0m
[1mss8_replace[22m() replaces the substring of the [1mss8str [22mat [4mdest[24m starting at
byte position [4mpos[24m and having length up to [4mlen[24m (limited by the length of
the destination string) with the contents of the [1mss8str [22mat [4msrc[24m. Behav‐
ior is undefined unless [4mdest[24m and [4msrc[24m point to valid and distinct [1mss8str[0m
objects and [4mpos[24m is less than or equal to the length of the destination
string.
[1mss8_replace_cstr[22m() replaces the substring of the [1mss8str [22mat [4mdest[24m start‐
ing at byte position [4mpos[24m and having length up to [4mlen[24m with the null-ter‐
minated byte string [4msrc[24m. Behavior is undefined unless [4mdest[24m points to a
valid [1mss8str [22mobject, [4mpos[24m is less than or equal to the length of the
destination string, and [4msrc[24m is a null-terminated byte string that does
not overlap with the internal buffer of [4mdest[24m.
[1mss8_replace_bytes[22m() replaces the substring of the [1mss8str [22mat [4mdest[24m start‐
ing at byte position [4mpos[24m and having length up to [4mlen[24m with the byte
string of length [4msrclen[24m located at [4msrc[24m. Behavior is undefined unless
[4mdest[24m points to a valid [1mss8str [22mobject, [4mpos[24m is less than or equal to the
length of the destination string, and [4msrc[24m is not NULL and points to an
array of at least [4msrclen[24m bytes that does not overlap with the internal
buffer of [4mdest[24m.
[1mss8_replace_ch[22m() replaces the substring of the [1mss8str [22mat [4mdest[24m starting
at byte position [4mpos[24m and having length up to [4mlen[24m with the single byte
[4mch[24m. Behavior is undefined unless [4mdest[24m points to a valid [1mss8str [22mobject
and [4mpos[24m is less than or equal to the length of the destination string.
[1mss8_replace_ch_n[22m() replaces the substring of the [1mss8str [22mat [4mdest[24m start‐
ing at byte position [4mpos[24m and having length up to [4mlen[24m with [4mcount[24m copies
of the byte [4mch[24m. Behavior is undefined unless [4mdest[24m points to a valid
[1mss8str [22mobject and [4mpos[24m is less than or equal to the length of the desti‐
nation string.
[1mRETURN VALUE[0m
All 5 functions return [4mdest[24m.
[1mSEE ALSO[0m
[1mss8_cat[22m(3), [1mss8_erase[22m(3), [1mss8_insert[22m(3), [1mssstr[22m(7)
SSSTR 2023-12-30 [4mSS8_REPLACE[24m(3)