STRREPLACE

Purpose:

Replaces all instances of a pattern in a string with a new pattern.

Syntax:

STRREPLACE("srcstr", "patstr", "repstr", caseflag)

"srcstr"

-

A string. The source string.

"patstr"

-

A string. The original pattern to search for.

"repstr"

-

A string. The replacement pattern.

caseflag

-

Optional. An integer, the case sensitivity flag.

 

 

0:

case not significant

1:

case significant (default)

Returns:

A string, the result of replacing patstr with repstr in srcstr.

Example:

strreplace("This is the source string", "source", "resulting")

 

returns "This is the resulting string".

Example:

strreplace("aaa AAA", "AAA", "new text here")

 

returns "aaa new text here" since STRREPLACE defaults to case sensitive replacement.

Example:

strreplace("aaa AAA", "AAA", "new text here", 0)

 

returns "new text here new text here" since case insensitive replacement is specified.

Remarks:

If no match is found, the original string is returned.

 

The pattern and replacement strings can be of different lengths.

 

STRREPLACE defaults to case sensitive string replacement.

 

STRREPLACE can be abbreviated STRREP.

 

See FILESTRREP to replace a string in a list of files.

See Also:

FILESTRREP

STRCAT

STRCMP

STREXTRACT

STRFIND

STRGET

STRMATCH

STRSORT