Einzelnen Beitrag anzeigen

btbe

Registriert seit: 15. Okt 2004
20 Beiträge
 
#10

Re: Zeichenkette zwischen kommas aus string in array schreib

  Alt 11. Nov 2004, 16:40
Delphi-Quellcode:
...

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    ComPort: TApdComPort;
    Label1: TLabel;
    Button1: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Timer1: TTimer;
    function Explode(const Separator, S: string; Limit: Integer = 0): TStringDynArray;
    procedure ComPortTriggerAvail(CP: TObject; Count: Word);
    procedure Timer1Timer(Sender: TObject);

...

implementation

{$R *.dfm}


function Explode(const Separator, S: string; Limit: Integer = 0): TStringDynArray;
var
  SepLen: Integer;
  F, P: PChar;
  ALen, Index: Integer;
begin
  SetLength(Result, 0);
  if (S = '') or (Limit < 0) then Exit;
  if Separator = 'then
  begin
    SetLength(Result, 1);
    Result[0] := S;
    Exit;
  end;
  SepLen := Length(Separator);
  ALen := Limit;
  SetLength(Result, ALen);

  Index := 0;
  P := PChar(S);
  while P^ <> #0 do
  begin
    F := P;
    P := AnsiStrPos(P, PChar(Separator));
    if (P = nil) or ((Limit > 0) and (Index = Limit - 1)) then P := StrEnd(F);
    if Index >= ALen then
    begin
      Inc(ALen, 5);
      SetLength(Result, ALen);
    end;
    SetString(Result[Index], F, P - F);
    Inc(Index);
    if P^ <> #0 then Inc(P, SepLen);
  end;
  if Index < ALen then SetLength(Result, Index);
end;
...
was hab ich hier falsch gemacht? bekomme diese meldung
Zitat:
[Error] Unit1.pas(19): Undeclared identifier: 'TStringDynArray'
  Mit Zitat antworten Zitat