#1 2018-06-08 16:58:18

Junior/RO
Member
Registered: 2011-05-13
Posts: 201

Bug in CSVToRawUTF8DynArray

Found a bug today. Using D7 and the current git version.

When parsing the string/CSV '-1,25,0' after a call to CSVToRawUTF8DynArray(),  the CSV array will have only two elements: ('-1','25). The last element, '0' will be left out.

Code to reproduce:

     procedure BugCSVToRawUTF8DynArray;
     var
       CSV: TRawUTF8DynArray;
     begin
       CSVToRawUTF8DynArray('-1,25,0', ',', #0, CSV);
       Assert(Length(CSV) = 3);
     end;

Last edited by Junior/RO (2018-06-08 16:58:38)

Offline

#2 2018-06-08 23:54:45

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,165
Website

Re: Bug in CSVToRawUTF8DynArray

You are wrongly setting #0 as end of line, which does not make any sense (#0 is already an end-of line separator).

The following code works as expected:

  CSVToRawUTF8DynArray('-1,25,0',arr);
  check(Length(arr)=3);
  Check(arr[0]='-1');
  Check(arr[1]='25');
  Check(arr[2]='0');

Offline

#3 2018-06-09 17:43:06

Junior/RO
Member
Registered: 2011-05-13
Posts: 201

Re: Bug in CSVToRawUTF8DynArray

I see now. Thank you.

Offline

Board footer

Powered by FluxBB