All pastes #201484 Raw Edit

Gregz

public text v1 · immutable
#201484 ·published 2006-10-13 21:17 UTC
rendered paste body
function Explode(text: string; seperator: Char): tarray;
var 
  s: string; 
  m: Integer; 
  c: Char; 
begin
  Result := nil; 
  s := ''; 
  for m := 1 to Length(text) do 
  begin
    c := text[m]; 
    if c = seperator then 
    begin 
      SetLength(Result, Length(Result) + 1);
      Result[Length(Result) - 1] := s;
      s := ''; 
    end 
    else 
      s := s + c; 
  end;
  if s <> '' then 
  begin 
    SetLength(Result, Length(Result) + 1); 
    Result[Length(Result) - 1] := s; 
  end; 
end;