[fpc-pascal] TStringList.SetCommaText needs refactor

AlexeyT aaa5500 at ya.ru
Sat Nov 9 17:48:18 CET 2019


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



More information about the fpc-pascal mailing list