Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TStringArray = array of string;
- function StringSplit(const what : string; const delim : string) : TStringArray;
- var
- a : TStringArray;
- tmps : string;
- idx, size, to_pos : Integer;
- was_end : Boolean;
- begin
- was_end := False;
- tmps := what;
- size := CharCount(delim[1], what) + 1;
- SetLength(a, size+1);
- for idx := 1 to size do
- begin
- to_pos := Pos(delim, tmps)-1;
- if to_pos = -1 then
- begin
- to_pos := Length(tmps);
- was_end := True;
- end;
- a[idx] := Copy(tmps, 0, to_pos);
- if was_end then Break;
- Delete(tmps, 1, to_pos+1);
- end;
- StringSplit := a;
- end;
Add Comment
Please, Sign In to add comment