&rep, &irep, &xrep, &xirep - Replace string in string functions
&rep str1 str2 str3
&irep str1 str2 str3
&xrep str1 str2 str3
&xirep str1 str2 str3
These functions search for str2 in str1, replacing it with str3, returning the resultant string.
The functions may all be abbreviated to their three letter abbreviation (i.e. &xirep may be expressed as &xir). In all cases the first argument is completely evaluated before the second and third arguments.
&rep string search replace
&irep string search replace
&xrep string regex-search regex-replace
&xirep string regex-search regex-replace
The following example turns a UNIX format file name (using a '/' to divide directories - like MicroEmacs) into an windows format name (using a '\'):
set-variable #l0 &rep #l0 "/" "\\"
The following example replaces one or more white spaces in the variable with a single space, this is an easy way to remove unnecessary spaces:
set-variable #l0 "This is not so spacey after xrep" set-variable #l0 &xrep #l0 "\\s +" " " ml-write #l0
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12