AnsiReplaceStr
Belongs to : FunctionDescription
The AnsiReplaceStr function replaces all occurences of the Needle string in the Haystack string with a NewNeedle string.
It is a Case sensitive command.
Example code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 |