[fpc-devel] Copy() and ZeroBaseStrings
Kazantsev Alexey
kazantsev.alexey at mail.ru
Mon Apr 7 11:29:03 CEST 2025
On Sun, 6 Apr 2025 23:18:47 +0200
Bart via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> Hi,
>
> Is this a known issue?
> Outputs:
> S[0] = "A" [Ok]
> S[1] = "B" [Ok]
> S[2] = "C" [Ok]
> Copy(S,0,1) = "A" [Ok]
> Copy(S,1,1) = "A", FAIL: expected: B
In the Delphi {$zerobasedstrings on/off} :
1. String's intrinsic functions as Copy, Insert, Delete, etc used always 1-based indexing.
2. StringHelper's functions s.Copy, s.Insert, s.Delete etc used always 0-based indexing.
3. Only direct char indexing s[n] depends on {$zerobasedstrings} directive.
--
Kazantsev Alexey
More information about the fpc-devel
mailing list