Autor Beitrag
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 26.03.05 16:57 
hi also das soll getrennt werden

Andreas Freund: 15487/18Jahre

adnreas in listbox1
die nummer in listbox2
und das alter in listbox3

wie mache ich das am besten und am einfachsten

Danke für euche Posts


MfG sauger chris
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: Sa 26.03.05 17:07 
ich würde sage mal beim trennungzeichen ansetzten.
du setzt den zeiger an den zeilenanfang beginst zu zeichen für zeichen zulesen bis zum doppelpunkt wenn dieser kommt wird das gesamt wort markiert und in die list box geschrieben und genauso machst du das dann auch mit den weiten werten.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 17:14 
Mit Copy und Pos.
Sauger Chris Threadstarter
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 26.03.05 17:42 
hat mir keiner einen beispiel quelltext

wäre nett danke
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 17:53 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Var
 I: Integer;
 S: String;
begin
 S := '123/123Jahre';
 I := Pos('/',S);
 if I > 0 then
  ShowMessage(Copy(S,1,I-1)); // "123"
 // ...

Den Rest solltest du dann selbst schaffen. Den Substring "Jahre" vom Rest zu trennen sollte ja einfach sein (einfach die letzten paar Chars weglassen)
Hein Blöd
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 51



BeitragVerfasst: Sa 26.03.05 17:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var
  s, s1, s2, s3: String;
begin
  s := 'Andreas Freund: 15487/18Jahre';

  s1 := Copy(s, 1, Pos(' ', s) - 1);
  Delete(s, 1, Pos(':', s));
  s := Trim(s);

  s2 := Copy(s, 1, Pos('/', s) - 1);
  Delete(s, 1, Pos('/', s));

  s3 := s;

  ShowMessage(s1 + #10#13 + s2 + #10#13 + s3);
end;
Sauger Chris Threadstarter
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 26.03.05 18:25 
ok danke nur noch eine frage wie lösche ich leere listbox einträge
(automatisch)

danke
MfG sauger chris
Hein Blöd
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 51



BeitragVerfasst: Sa 26.03.05 18:31 
ausblenden Delphi-Quelltext
1:
ListBox1.Clear;					
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.03.05 18:32 
ausblenden Delphi-Quelltext
1:
ListBox.Clear					

//Edit: war zu spät (post löschen)
Sauger Chris Threadstarter
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 26.03.05 18:35 
ä sorry aber ich meinte das so

hallo

wie geht es dir

der eintrag zwischen hallo und wie geht es dir soll gelöscht werden und nicht alles :)

MfG sauger chris
Hein Blöd
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 51



BeitragVerfasst: Sa 26.03.05 18:44 
Gib dir etwas Mühe und formuliere die Fragen anständig.

Automatisch geht nichts. wenn, dann mußt du es programmieren.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var
  i: Integer;
begin
  with ListBox1 do
    for i := Items.Count - 1 downto 0 do
      if Trim(Items[i]) = '' then
        Items.Delete(i);
end;