StrReplace

Replaces all occurrences of a sub-string with another.

Syntax:

StrReplace (string, old, new)

Parameters:

(s) string string in which to search.

(s) old target sub-string.

(s) new replacement sub-string.

Returns:

(s) updated string, with old replaced by new.

 

StrReplace scans the "string", searching for occurrences of "old" and replacing each occurrence with "new".

Example:


; Copy all INI files to clipboard
a = FileItemize("*.ini")
;in file list replace tabs with crlf's.
b = StrReplace(a, @TAB, @CRLF)
ClipPut(b)
newlist=StrCat("Before", @CRLF, a,@CRLF,@CRLF,"After", @CRLF, b)
Message("StrReplace",newlist)
See Also:

StrInsert, StrScan, StrSub, StrIndex, StrIndexNc, StrIndexWild, StrOverlay