[fpc-pascal] TStringHelper.Split() issue?
Michael Van Canneyt
michael at freepascal.org
Wed Mar 9 20:57:03 CET 2016
On Tue, 8 Mar 2016, Rik van Kekem wrote:
> Michael Van Canneyt wrote:
>>> On FPC, it returns 1, on Delphi, it returns 2. And debuging the "splited"
>>> variable, on FPC I get only and "x" value, Delphi "x" and "y".
>>> Is this a bug?
>> Yes. Quite strange, because I have testcases for this ?
> And content: string = 'x:yb'; does work correctly.
> The problem is in this line (Line 1196 of syshelp.inc):
> if (LastSep<Length-1) and ((ACount=0) or (Len<ACount)) then
> In this case LastSep is 2 and Length - 1 is also 2.
> So the last y doesn't get into the array.
Indeed, this is the problem. Fixed in rev. 33209.
Added testcase to my testsuite.
Probably the zero-based nature of these methods got me confused :/
More information about the fpc-pascal