Autor Beitrag
cromos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: Di 30.09.03 11:58 
Hi,

wie stückle ich einen kommaseparierten String?

Gruss
Cromos


Zuletzt bearbeitet von cromos am Di 30.09.03 13:23, insgesamt 1-mal bearbeitet
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Di 30.09.03 12:00 
es gibt da eine function: getToken(..);

hab aber noch nicht mit gearbeitet...sollte aber genau das machen, was du suchst

_________________
mfg.
mâximôv
ShadowThief
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 30.09.03 13:10 
es gibt noch na andere lustige möglichkeit, ist jedoch kein
guter programmierstil, denk ich.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  sl: TStringList;

begin

  sl := TStringList.Create;
  sl.Text := StringReplace(DeinString, ','#13 + #10, [rfReplaceAll]);


jetzt hast du DeinString in sl.Strings[] drinnen.

Falls allerdings in DeinString vorher schon CrLf's drinnen waren,
dann musst du dir was anderes überlegen.

shadow.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 30.09.03 13:22 
Die StringList verfügt bereits über ein entsprechendes Property:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var 
  sl: TStringList; 
begin 
  sl := TStringList.Create; 
  try
    sl.CommaText := DeinString;
  finally
    sl.Free;
  end;
end;
cromos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 219


Delphi 7
BeitragVerfasst: Di 30.09.03 13:22 
Hallo

hab es hinbekommen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
sl:=TStringList.Create;
        try
          sl.Delimiter:=',';
          sl.DelimitedText:=IniPak;
            for sli := 0 to sl.Count -1 do
              for lbi := 0 to clb1.Count -1 do
                if sl[sli] = clb1.items[lbi] then clb1.Checked[lbi] := true;

        finally
          sl.Free;
        end;


Gruss
Cromos
ShadowThief
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278



BeitragVerfasst: Di 30.09.03 21:22 
Tino hat folgendes geschrieben:
Die StringList verfügt bereits über ein entsprechendes Property


du kannst dir nicht vorstellen, wie oft ich das schon gebraucht hätte ...
:autsch:
Ra2k
Hält's aus hier
Beiträge: 8

WinXP Build 2600 SP2
D7 Prof
BeitragVerfasst: Di 30.09.03 21:28 
na dass is ja loel, grad heute hab ich das selbe problem. ich wollte mal wissen wie ich das machen soll wenn ich den string aus einer listbox entnehme - /me is nämlich nich ganz der profi in delphi, noch nich :D

Sebastian