Description |
The AnsiReplaceStr function replaces all occurences of the Needle string in the Haystack string with a NewNeedle string.
It is a Case sensitive command.
|
|
Related commands |
Copy |
|
Create a copy of part of a string or an array |
Insert |
|
Insert a string into another string |
Move |
|
Copy bytes of data from a source to a destination |
StringReplace |
|
Replace one or more substrings found within a string |
StuffString |
|
Replaces a part of one string with another |
|
|
|
Example code : A simple example |
var
haystack : AnsiString;
begin
haystack := 'The big cat sat on the big mat'; ShowMessage(haystack); // Display the haystack at the start
// Note that AnsiReplaceStr is case sensitive
haystack := AnsiReplaceStr(haystack, 'BIG', 'LITTLE'); ShowMessage(haystack); // Display the haystack now
haystack := AnsiReplaceStr(haystack, 'big', 'little'); ShowMessage(haystack); // Display the haystack now
end;
|
Show full unit code |
The big cat sat on the big mat
The big cat sat on the big mat
The little cat sat on the little mat
|
|