-@cindex strings, searching backwards
-@deftypefn {Function} {} RINDEX (@var{haystack}, @var{needle})
-Returns a positive integer indicating the position of the last
-occurrence of @var{needle} in @var{haystack}. Returns 0 if
-@var{haystack} does not contain @var{needle}. Returns system-missing if
-@var{needle} is an empty string.
-@end deftypefn
-
-@deftypefn {Function} {} RINDEX (@var{haystack}, @var{needle}, @var{needle_len})
-Divides @var{needle} into parts, each with length @var{needle_len}.
-Searches @var{haystack} for the last occurrence of each part, and
-returns the largest value. Returns 0 if @var{haystack} does not contain
-any part in @var{needle}. It is an error if @var{needle_len} does not
-evenly divide the length of @var{needle}. Returns system-missing
-if @var{needle} is an empty string or if needle_len is less than 1.
-@end deftypefn
-
-@cindex padding strings
-@cindex strings, padding
-@deftypefn {Function} {} RPAD (@var{string}, @var{length})
-If @var{string} is at least @var{length} characters in length, returns
-@var{string} unchanged. Otherwise, returns @var{string} padded with
-spaces on the right to length @var{length}. Returns an empty string if
-@var{length} is system-missing, negative, or greater than 255.
-@end deftypefn
-
-@deftypefn {Function} {} RPAD (@var{string}, @var{length}, @var{padding})
-If @var{string} is at least @var{length} characters in length, returns
-@var{string} unchanged. Otherwise, returns @var{string} padded with
-@var{padding} on the right to length @var{length}. Returns an empty
-string if @var{length} is system-missing, negative, or greater than 255,
-or if @var{padding} does not contain exactly one character.
-@end deftypefn
-
-@cindex strings, trimming
-@cindex white space, trimming
-@deftypefn {Function} {} RTRIM (@var{string})
-Returns @var{string}, after removing trailing spaces. Other types of
-white space are not removed.
-@end deftypefn
-
-@deftypefn {Function} {} RTRIM (@var{string}, @var{padding})
-Returns @var{string}, after removing trailing @var{padding} characters.
-If @var{padding} does not contain exactly one character, returns an
-empty string.
+@cindex strings, replacing substrings
+@cindex replacing substrings
+@deftypefn {Function} {} REPLACE (@var{haystack}, @var{needle}, @var{replacement}[, @var{n}])
+Returns string @var{haystack} with instances of @var{needle} replaced
+by @var{replacement}. If nonnegative integer @var{n} is specified, it
+limits the maximum number of replacements; otherwise, all instances of
+@var{needle} are replaced.