View Issue Details

IDProjectCategoryView StatusLast Update
0038086FPCDocumentationpublic2020-11-16 09:13
ReporterZoran Vučenović Assigned ToMichael Van Canneyt  
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038086: Copy function without third argument works not only in Delphi mode, but also in other modes
DescriptionThe 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.

Steps To Reproduceprogram Project1;

// Uncomment any mode and try:
//{$mode Delphi}
//{$mode objfpc}
//{$mode fpc}
//{$mode tp}

  S1, S2: AnsiString;
  A1, A2: Array of SmallInt;
  I: Integer;
  S1 := 'Hello, World!';
  S2 := Copy(S1, 8);

  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], ',');


TagsNo tags attached.
Fixed in Revision1782
Attached Files


Zoran Vučenović

2020-11-15 21:31

reporter   ~0126979

Ah, and it does not work with ShortString. Not even in Delphi mode, which also should be documented.

Sven Barth

2020-11-16 09:05

manager   ~0126980

As I've mentioned on the forum, the part about ShortString was a bug and it's fixed in trunk.

Michael Van Canneyt

2020-11-16 09:09

administrator   ~0126981

Fixed, thanks for reporting !

Issue History

Date Modified Username Field Change
2020-11-15 21:27 Zoran Vučenović New Issue
2020-11-15 21:27 Zoran Vučenović Status new => assigned
2020-11-15 21:27 Zoran Vučenović Assigned To => Michael Van Canneyt
2020-11-15 21:31 Zoran Vučenović Note Added: 0126979
2020-11-16 09:05 Sven Barth Note Added: 0126980
2020-11-16 09:09 Michael Van Canneyt Status assigned => resolved
2020-11-16 09:09 Michael Van Canneyt Resolution open => fixed
2020-11-16 09:09 Michael Van Canneyt Fixed in Version => 3.3.1
2020-11-16 09:09 Michael Van Canneyt Fixed in Revision => 1781
2020-11-16 09:09 Michael Van Canneyt FPCTarget => 3.2.2
2020-11-16 09:09 Michael Van Canneyt Note Added: 0126981
2020-11-16 09:13 Michael Van Canneyt Fixed in Revision 1781 => 1782