Hi,

Consider this example:

program split;
{$mode objfpc}
{$h+}

uses
  sysutils;

var
  S: string;
  A: TStringArray;
  i: Integer;

begin
  S := '1 2 3 4 5';
  A := S.Split([#32],'"');
  writeln('S = ',S,', Separators = #32');
  for i := Low(A) to High(A) do writeln(format('%d: "%s"',[i,A[i]]));
  writeln;

  S := '1\n2\n3\n4\n5';
  A := S.Split(['\n'],'"');
  writeln('S = ',S,', Separators = \n');
  for i := Low(A) to High(A) do writeln(format('%d: "%s"',[i,A[i]]));
end.

Output:
S = 1 2 3 4 5, Separators = #32
0: "1"
1: "2"
2: "3"
3: "4"
4: "5"

S = 1\n2\n3\n4\n5, Separators = \n
0: "1"
1: "2"
2: "3"
3: "4"

I would expect the output would be the same for both versions of split?
The "string" version misses the last one?

-- 
Bart
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to