Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-11

TStringList.SetCommaText needs refactor

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

AlexeyT

It's obvious this needs to use SetDelimetedText with other params (2nd 3rd)

Procedure TStrings.SetCommaText(const Value: string);
begin
   CheckSpecialChars;
   C1:=Delimiter;
   C2:=QuoteChar;
   Delimiter:=',';
   QuoteChar:='"';
   Try
     SetDelimitedText(Value);
   Finally
     Delimiter:=C1;
     QuoteChar:=C2;
   end;
end;

it's obvious this needs to be changed too:

procedure TStrings.AddCommaText(const S: String);
var
   L: TStringList;
begin
   L := TStringList.Create;
   try
     L.CommaText := S;
     AddStrings(L);
   finally
     L.Free;
   end;
end;
Regards, Alexey

Reply by email

Michael Van Canneyt
to AlexeyT

Please create bugreports.

Michael.

AlexeyT wrote 42 lines
It's obvious this needs to use SetDelimetedText with other params (2nd 3rd) Procedure TStrings.SetCommaText(const Value: string); begin   CheckSpecialChars;   C1:=Delimiter;   C2:=QuoteChar;   Delimiter:=',';   QuoteChar:='"';   Try     SetDelimitedText(Value);   Finally     Delimiter:=C1;     QuoteChar:=C2;   end; end; it's obvious this needs to be changed too: procedure TStrings.AddCommaText(const S: String); var   L: TStringList; begin   L := TStringList.Create;   try     L.CommaText := S;     AddStrings(L);   finally     L.Free;   end; end; -- Regards, Alexey _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email