SplitString vs Split difference

103 views Asked by At

Consider this sample program comparing StrUtils.SplitString and SysUtils.TStringHelper.Split:

Program Test;
{$APPTYPE CONSOLE}
Uses
  System.SysUtils,System.Types,StrUtils;

var
  s: String;
  a: TArray<String>; 
  b: TStringDynArray;
begin
  s := ':';
  a := s.Split([':']);  
  WriteLn(Length(a)); 
  b := SplitString(s,':');
  WriteLn(Length(b));
  ReadLn;
end.

The output is:

1
2

Can anyone explain the difference?

I would expect that the result is 2 empty strings.

0

There are 0 answers