Skip to content

Copy ​

The Copy function returns a sub-string of Count characters of the string S, starting at position given by Index.

Index should be set to 1 for the first character.

Count is the number of characters to return, including the starting character.

Declaration: function Copy(S: string; Index: Integer; Count: Integer): string;

An example.

pascal
procedure OnMapEvent(var Value:Variant);
Var Str1, Str2, Str3 : string;
begin
  Str1 := Copy('This is from volume 6 of the series.',21,2);     //returns '6 '
  LogInfo(Str1);
  Str2 := Copy('This is from volume 12 of the series.',21,2);    //returns '12'
  LogInfo(Str2);
  Str3 := Copy('This is from volume 12 of the series.',6,2);    //returns 'is'
  LogInfo(Str3);
end;