Description |
The TReplaceFlags enumeration type gives the options for the StringReplace routine :
rfReplaceAll | Replace all find occurences |
rfIgnoreCase | Find ignores case |
|
|
Related commands |
StringReplace |
|
Replace one or more substrings found within a string |
|
|
|
Example code : Change all occurences regardless of case |
var
before, after : string;
options : TReplaceFlags;
begin // Try to replace all occurrences of a or A to THE
before := 'This is a way to live A big life';
// Set the options to change all occurences regardless of case
options := [rfReplaceAll, rfIgnoreCase];
// Now change 'a' or 'A' to 'THE' throughout
after := StringReplace(before, ' a ', ' THE ', options);
// Show the before and after
ShowMessage('Before = '+before);
ShowMessage('After = '+after);
end;
|
Show full unit code |
This is a way to live A big life
This is THE way to live THE big life
|
|