Icon Copy

Unit: Internal

Available In: Client and Server Applications

function Copy(const Value: String; Index: Integer;
              Count: Integer): String

function Copy(const Value: String; Index: Integer): String

function Copy(const Value: String): String

function Copy(const Value: array of <Type>; Index: Integer;
              Count: Integer): array of <Type>

function Copy(const Value: array of <Type>; Index: Integer): array of <Type>

function Copy(const Value: array of <Type>): array of <Type>

The Copy function returns a portion of the Value string or array input parameter. The optional Index input parameter specifies where to start the copy, and the optional Count input parameter specifies the length to copy. If the Count input parameter is not specified, then the copy will proceed until the end of the Value input parameter. If neither the Index or Count input parameters are specified, then an exact copy of the Value input parameter will be returned.

Information Please remember that indexes into String values are 1-based, whereas indexes into arrays are 0-based. For more information on these types, please see the Types topic.

Examples

X := Copy('abcdef', 4, 3);  // X is 'def'
X := Copy('abcdef', 2);  // X is 'bcdef'
X := Copy([10,20,30,40], 0, 3);  // X is [10,20,30]
Image