Autor Beitrag
Samarek
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 23

Win 7 Prof, Ubuntu 9.10
Java(Eclipse), C/C++/C# (VS 2008, VC# EE)
BeitragVerfasst: Sa 19.09.09 13:06 
hi

wüsste gern mal wie ich mit pos, posex und copy aus einer stringlist bestimmte zeichenketten rausbekomme
irgendwie check ich die delphi-hilfe da nich so ganz

_________________
Dank und Gruß
Samarek
noo.bee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: Sa 19.09.09 13:35 
also bin auf dem gebiet auch sehr neu :D schau mal hier - das hat mich auch um einiges schlauer gemacht ;)

www.delphi-treff.de/...verarbeitung/page/2/
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: Sa 19.09.09 14:38 
hiho das hier sollte dir weiter helfen :)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var posi1,a : integer;
    finish : Tstringlist;
begin
finish := TStringList.Create;
finish.loadfromfile('c:\datei.txt');
try
for a:=0 to finish.Count -1 do
begin
      posi1    := pos('Such text', finish.Strings[a]);

listview.Items.Add.Caption:= copy(finish.Strings[a],posi1,50); // posi 1 + 50 zeichen in die listview komp schreiben
end;
except
finish.free;
end;
Samarek Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 23

Win 7 Prof, Ubuntu 9.10
Java(Eclipse), C/C++/C# (VS 2008, VC# EE)
BeitragVerfasst: Sa 19.09.09 15:00 
ahja, das hilft mir weiter
vielen lieben dank
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 19.09.09 20:16 
Das LoadFromFile gehört aber auch in den Ressourcenschutzblock, sonst hat man nen schönes Speicherleck, wenn dort ein Fehler auftritt. ;-)
Also ordentlich formatiert so ca.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
  posi1, a: Integer;
  finish: TStringList;
begin
  finish := TStringList.Create;
  try
    finish.LoadFromFile('c:\datei.txt');
    for a := 0 to finish.Count - 1 do
    begin
      posi1 := Pos('Such text', finish[a]);
      ListView.Items.Add.Caption := Copy(finish[a], posi1, 50); // posi 1 + 50 zeichen in die listview komp schreiben
    end;
  except
    finish.free;
  end;
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: So 20.09.09 04:36 
jaenicke ich hab an dich gedacht wo ich den post geschrieben hab,
habs nur zu schnell getippselt :P aber hast recht =)