ss_string_rreplace_c_string_l(3) - Linux man page

Name

ss_string_replace family - replaces a substring with another

one

Synopsis

#include <sstrings2.h>

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 is

NULL

SS_NOMEM if there is no more memory left

SS_EINVAL if the ss_string

objects are invalid

Bugs

Please send your bug reports to yanezp@informatik.uni-freiburg.de

See Also

ss_string_new(3), ss_string_crop(3), ss_string_rcrop(3), ss_string_replace(3), ss_string_rreplace(3)

Referenced By

sstrings2(5)