Nur mal ein Beispiel, was es so in den letzten vielen Jahren "Neues" im Delphi gab.
SplitString, ReplaceStr (k.A. warum sorum, aber dafür ohne die Flags), For-In
Delphi-Quellcode:
begin
TextLength := Length(ARichEdit.Text);
for S in SplitString(AWordsStr, ' ') do
ColorAWord(S);
end;
bzw.
Delphi-Quellcode:
begin
TextLength := Length(ARichEdit.Text); // TextLength := ARichEdit.Text.Length;
for S in SplitString(AWordsStr, ' ') do begin
SP := ARichEdit.FindText(ASearchStr, 0, TextLength, []);
while SP <> -1 do begin
ARichEdit.SelStart := SP;
ARichEdit.SelLength := Length(S);
ARichEdit.SelAttributes.Color := clRed;
SP := ARichEdit.FindText(ASearchStr, SP + Length(S) {SP + S.Length}, TextLength, []);
end;
end;
end;