>could you tell me how to use “stringreplace”
>and if you don’t mind please send me a sample code
Are you having a specific problem with StringReplace?
From the help:
>>>>
TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
function StringReplace(const S, OldPattern, NewPattern: string; Flags:
TReplaceFlags): string;
<<<<
Examples:
[code lang=”delphi”]var s: string;
begin
s := Memo1.Text;
// replace just the first occurrence of ‘old’ with ‘new’
StringReplace(s, ‘old’, ‘new’, []);
// replace ALL occurrences of ‘old’ with ‘new’
StringReplace(s, ‘old’, ‘new’, [rfReplaceAll]);
// replace just the first occurrence of ‘old’ with ‘new’ ignore
character case
StringReplace(s, ‘old’, ‘new’, [rfIgnoreCase]);
// … all occurrences and ignore character case
StringReplace(s, ‘old’, ‘new’, [rfReplaceAll, rfIgnoreCase]);
Memo1.Text := s;
end;
[/code]
[tags]Delphi, Strings[/tags]
0 Kommentare zu “How to use “stringreplace””