[fpc-pascal] TStringList - Strange quotation mark handling

Gabor Boros mlnglsts at bgss.hu
Wed Aug 16 14:28:10 CEST 2017


Hi All,

With the attached example program and data.csv I got the next result:

0 * 84392
1 * asfds
2 * hytr
3 * 43421454
4 * O
5 *  fdsfds
6 * 654645645 "O" fdsfsd
7 * hgfgfedw
8 * fg
9 * 321.544
10 * 89
11 * 0


"O" fdsfds - broken into two parts which is bad from my POV. See 4 * O 
and 5 *  fdsfds. Why?

Gabor
-------------- next part --------------
?84392|asfds|hytr|43421454|"O" fdsfds|654645645 "O" fdsfsd|hgfgfedw|fg|321.544|89|0
-------------- next part --------------
program Project1;

uses Classes, sysutils;

var
  SL,SL2:TStringList;
  i:integer;

begin
  SL:=TStringList.Create;
  SL.LoadFromFile('data.csv');

  SL2:=TStringList.Create;
  SL2.StrictDelimiter:=True;
  SL2.Delimiter:='|';
  SL2.DelimitedText:=SL[0];

  for i:=0 to SL2.Count-1 do WriteLn(IntToStr(i)+' * '+SL2[i]);

  ReadLn;
end.


More information about the fpc-pascal mailing list