Contents | Prev | Next
7.2.7 The copy function
Description
The copy function accepts up to three of the parameters described below (the
last parameter is optional), and returns a value of type
string which is formed by copying zero or more characters
from the first parameter.
Parameters
- The first parameter S is an
expression of type
string or type char,
and contains the characters to be copied.
- The second parameter P is an
expression of
integral type, and specifies the position, in
S of the first character to copy. If P is greater than the
number of charaters in S then no characters are copied.
- The third parameter N is an
expression of
integral type, and specifies the number of characters to
copy. If N is omitted or is greater than the number of characters in
S from P to the end, then all characters in S
starting from P to the end are returned.
Example
copy('Testing...', 5, 2) returns 'in'
copy('Testing...', 7) returns 'g...'
copy('Testing...', 1, 1000) returns 'Testing...'
copy('Testing...', 50) returns ''
Portability
Operating Systems: All
Standard Pascal: No
Contents | Prev | Next