Copy function without third argument works not only in Delphi mode, but also in other modes
Original Reporter info from Mantis: zoran
-
Reporter name: Zoran Vučenović
Original Reporter info from Mantis: zoran
- Reporter name: Zoran Vučenović
Description:
The documentation for Copy function says:
In Delphi mode, the Count argument can be omitted. In that case, the string (or dynamic array) is copied from the position Index till the end of the string or array.
However, it also works the same in other modes.
See: https://www.freepascal.org/docs-html/current/rtl/system/copy.html
Steps to reproduce:
program Project1;
// Uncomment any mode and try:
//{$mode Delphi}
//{$mode objfpc}
//{$mode fpc}
//{$mode tp}
var
S1, S2: AnsiString;
A1, A2: Array of SmallInt;
I: Integer;
begin
S1 := 'Hello, World!';
S2 := Copy(S1, 8);
WriteLn(S2);
SetLength(A1, 9);
for I := Low(A1) to High(A1) do
A1[I] := I;
A2 := Copy(A1, 5);
for I := Low(A2) to High(A2) do
Write(A2[I], ',');
WriteLn;
ReadLn;
end.
Mantis conversion info:
- Mantis ID: 38086
- Version: 3.2.0
- Fixed in version: 3.3.1
- Fixed in revision: 1782 (#b8e7684a)
- Target version: 3.2.2