Registriert seit: 6. Apr 2005
10.109 Beiträge
|
Re: zeilenzugriff im memo
29. Jun 2005, 13:18
Oder so:
Delphi-Quellcode:
uses
Classes,
SysUtils;
function After(S, Pattern: String): String;
var
I: Integer;
begin
I := Pos(Pattern,S);
if I = 0
then Result := ''
else Result := Copy(S, I + Length(Pattern), Length(S));
end;
function Before(S, Pattern: String): String;
var
I: Integer;
begin
I := Pos(Pattern,S);
Delete(S, I, Length(S));
Result := S;
end;
function Between(S, Prefix, Suffix: String): String;
begin
Result := Before(After(S, Prefix), Suffix);
end;
procedure TextToGraphic(slSrc, slTgt, slGrade: TStringList);
const
pfx1 = 'Anvar sagt: ';
sfx1 = ' ';
pfx2 = 'beherrschst Du ';
sfx2 = '.';
var
sAbility, sGrade: string;
i, iGrade: integer;
begin
slTgt.Clear;
for i := 0 to slSrc.Count - 1 do begin
sAbility := Between(slSrc[i], pfx1, sfx1);
sGrade := Between(slSrc[i], pfx2, sfx2);
iGrade := Succ(slGrade.IndexOf(sGrade));
slTgt.Values[sAbility] := StringOfChar('#', iGrade);
end;
end;
function CreateGrades: TStringList;
begin
Result := TStringList.Create;
// schlechtesten Rang zuerst hinzufügen
Result.Add('absolut perfekt');
end;
Grüße vom marabu
|
|
Zitat
|