Replace one or more substrings
(new, n) = strreplace (a, b, c, max_n)
String_Type a, b, c, rep;
Int_Type n, max_n;
The strreplace function may be used to replace one or more
occurances of b in a with c. If the integer
max_n is positive, then the first max_n occurances of
b in a will be replaced. Otherwise, if max_n is
negative, then the last abs(max_n) occurances will be replaced.
The function returns the resulting string and an integer indicating
how many replacements were made.
The following function illustrates how strreplace may be used
to remove all occurances of a specified substring
define delete_substrings (a, b)
{
(a, ) = strreplace (a, b, "", strlen (a));
return a;
}
- slangrtl
-
extract_element,
is_list_element,
is_substr,
str_replace,
strcompress,
strlow,
strsub,
strtrans,
strtrim,
strtrim_beg,
strtrim_end,
strup,
substr
|