expressions: Implement the REPLACE string function.
[pspp] / doc / expressions.texi
index 7226116bd13e8897c29c2dbf120acf913ca17857..b7e23a5f96c3d0721a4614832a09292a47bd67e9 100644 (file)
@@ -264,7 +264,7 @@ The sections below describe each function in detail.
 * Set Membership::              ANY RANGE
 * Statistical Functions::       CFVAR MAX MEAN MIN SD SUM VARIANCE
 * String Functions::            CONCAT INDEX LENGTH LOWER LPAD LTRIM NUMBER 
-                                RINDEX RPAD RTRIM STRING SUBSTR UPCASE
+                                REPLACE RINDEX RPAD RTRIM STRING SUBSTR UPCASE
 * Time and Date::               CTIME.xxx DATE.xxx TIME.xxx XDATE.xxx
                                 DATEDIFF DATESUM
 * Miscellaneous Functions::     LAG YRMODA VALUELABEL
@@ -620,6 +620,15 @@ right-padded with spaces.  If @var{string} is not in the correct
 format for @var{format}, system-missing is returned.
 @end deftypefn
 
+@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.
+@end deftypefn
+
 @cindex strings, searching backwards
 @deftypefn {Function} {} RINDEX (@var{haystack}, @var{needle})
 Returns a positive integer indicating the position of the last