Hello,

Conforms issue #16043:

"ExtractStrings in the Classes unit skips over empty text. For example:

"AAA,BBB,,CCC"

is converted to:

"AAA"
"BBB"
"CCC"

I was expecting:

"AAA"
"BBB"
""
"CCC"

Is this the intended behavior, or is it a bug?".

So, if I try:

procedure TForm1.Button1Click(Sender: TObject);
var
  s: TStringList;
begin
  s := TStringList.Create;
  try
    s.StrictDelimiter := True;
    s.Delimiter := '|';
    ExtractStrings(['|'], [], 'A|B||C', s);
    ShowMessage(IntToStr(s.Count));
  finally
    s.Free;
  end;
end;

It returns 3. But, if I try:

procedure TForm1.Button2Click(Sender: TObject);
var
  s: TStringList;
begin
  s := TStringList.Create;
  try
    s.StrictDelimiter := True;
    s.Delimiter := '|';
    s.DelimitedText := 'A|B||C';
    ShowMessage(IntToStr(s.Count));
  finally
    s.Free;
  end;
end;

It returns 4.

How to configure ExtractStrings to works without skip empty strings like
DelimitedText?

Thank you!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to