ss_string_rreplace_c_string(3) - Linux man page
Name
ss_string_replace family - replaces a substring with anotherone
Synopsis
Linking with -lsstrings2
int ss_string_replace(ss_string *string, const ss_string *pattern, const ss_string *replace);
int ss_string_replace_c_string(ss_string *string, const char *pattern, const char *replace);
int ss_string_replace_c_string_l(ss_string *string, const char *pattern, size_t patt_len, const char
*replace, size_t repl_len);
int ss_string_rreplace(ss_string *string, const ss_string *pattern, const ss_string *replace);
int ss_string_rreplace_c_string(ss_string *string, const char *pattern, const char *replace);
int ss_string_rreplace_c_string_l(ss_string *string, const char *pattern, size_t patt_len, const char
*replace, size_t repl_len);
Description
ss_string_replace replaces the first occurence of substring pattern in string with the string saved in replace. Note that all parameters must be valid ss_string objects (initialized ss_string_new),ss_string_replace_c_string replaces first occurence of substring pattern in string with the string replace. pattern and replace are both C-strings. Note that string must be a valid ss_string object.
ss_string_replace_c_string_l works like ss_string_replace_c_string. patt_len and repl_len are the right length of pattern and string. Note that this function does not check whether patt_len and repl_len are the right length of pattern and replace.
The ss_string_rreplace_* functions work the same way but they replace the last occurence of pattern in string.
Returning values
The functions return 1 on succes, -1 if pattern is not found. They return 0 on error.Error value of ss_errno
SS_NULL is a parameter isNULL
SS_NOMEM if there is no more memory left
SS_EINVAL if the ss_string
objects are invalid