Código Delphi
[-]type
TEgostar = class(TStringList)
private
function GetPoint(Index: Integer): TPoint;
function GetLines(Index: Integer): Integer;
function GetCaption(Index: Integer): string;
protected
property Point[Index: Integer]: TPoint read GetPoint;
property Lines[Index: Integer]: Integer read GetLines;
property Caption[Index: Integer]: string read GetCaption;
end;
implementation
function TEgostar.GetPoint(Index: Integer): TPoint;
var S: string;
begin
S := Copy(Strings[Index], Pos('=', Strings[Index]) + 1, 255);
Result.X := StrToInt(Copy(S, 1, Pos(',', S) - 1));
System.Delete(S, 1, Pos(',', S));
if Pos(',', S) = 0 then
Result.Y := StrToInt(S)
else
Result.Y := StrToInt(Copy(S, Pos(',', S) + 1, 255));
end;
function TEgostar.GetLines(Index: Integer): Integer;
var S: string;
begin
S := Strings[Index];
System.Delete(S, 1, Pos(',', S));
if Pos(',', S) = 0 then
Result := -1
else
Result := StrToInt(Copy(S, Pos(',', S) + 1, 255));
end;
function TEgostar.GetCaption(Index: Integer): string;
begin
Result := Copy(Strings[Index], 1, Pos('=', Strings[Index]) - 1)
end;
Prueba;
Código Delphi
[-]procedure TForm1.Button1Click(Sender: TObject);
var e: TEgostar; i: Integer;
begin
ListBox1.Clear;
e := TEgostar.Create;
e.LoadFromFile('xxx.txt');
for i := 0 to e.Count - 1 do
ListBox1.AddItem(e.Caption[i] + ' - ' + IntToStr(e.Point[i].X) + ':' + IntToStr(e.Point[i].Y) + ' (' + IntToStr(e.Lines[i]) + ')', nil);
e.Destroy;
end;