TStringList detected incorrect empty lines in partially quoted DelimitedText with spaces even when StrictDelimiter is true
Original Reporter info from Mantis: wp @wpam
-
Reporter name:
Original Reporter info from Mantis: wp @wpam
- Reporter name:
Description:
The documentation of TStringList.StrictDelimiter says:
&LtPos;i>When StrictDelimiter is set to True then only the Delimiter character is considered when splitting the text in items: no quoting whatsoever is performed when writing the DelimitedText property. However, when reading the DelimitedText property, quoted strings are taken into account (so a quoted string can contain a delimiter that is treated as text instead of a delimiter). &LtPos;/i>
Applied to the DelimitedText 'abc;"def" ;ghi' (note the space after the "def") I would expect this to split into three parts. FPC, however adds an additional empty line between 'def' and 'ghi'
Steps to reproduce:
Run this program:
program Project1; uses Classes; var SL: TStringList; i: Integer; begin SL := TStringList.Create; try SL.StrictDelimiter := true; SL.Delimiter := ';'; SL.DelimitedText := 'abc;"def" ;ghi'; for i := 0 to SL.Count-1 do WriteLn(i, ': ', SL[i]); finally SL.Free; end; ReadLn; end.
The output is
0: abc 1: def 2: 3: ghi
Tested on Windows 10 (64 bit) with Laz-trunk/FPC-trunk (32bit), and FPC 3.2.0 (32-bit and 64 bit), and FPC 3.0.4 (32-bit and 64 bit)
Mantis conversion info:
- Mantis ID: 37978
- Build: 3.2.0, 3.0.4, trunk