Autor Beitrag
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Sa 30.04.05 15:51 
hi
hab in einem string folgendes stehen:
string1:=('29, 229, 229, 40')
hab das ganze via ini file ingelesen.
nun möchte ich, dass er mir diesen string in folgendes zerlegt

var1=29
var2=229
var3=229
var4=40

is des schwer? ^^
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 30.04.05 16:01 
nein ist nicht schwer

schau dir die COPY und POS befehle an

wenn das dann als integer haben willst schau dir noch

STRTOINTDEF an

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 30.04.05 16:03 
ausblenden Delphi-Quelltext
1:
2:
uses
  Types;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
function Split(const AString: String): TStringDynArray;
var
  I: Integer;
begin

  with TStringList.Create do
    try
      CommaText := AString;
      SetLength(Result, Count);
      for I := 0 to Count - 1 do
        Result[I] := Strings[I];
    finally
      Free;
    end;

end;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
  StrArry: TStringDynArray;
begin

  StrArry := Split('29, 229, 229, 40');
  for I := 0 to High(StrArry) do
    ShowMessage(StrArry[I]);

end;

_________________
Ciao, Sprint.
en!gma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Sa 30.04.05 16:11 
oh thx
das wars schon :D