Title: How to split a string *VERY* fast using delimiters (function)
function split(input: string; schar: Char; s: Integer): string;
var
c: array of Integer;
b, t: Integer;
begin
Dec(s, 2); // for compatibility with very old & slow split function
t := 0; // variable T needs to be initialized...
setlength(c, Length(input));
for b := 0 to pred(High(c)) do
begin
c[b + 1] := posex(schar, input, succ(c[b]));
// BREAK LOOP if posex looped (position before previous)
// or wanted position reached..
if (c[b + 1] [b]) or (s ) then break
else
Inc(t);
end;
Result := Copy(input, succ(c[s]), pred(c[s + 1] - c[s]));
end;