Copies data from the source, starting at the offset for a specified length, and replaces the data in the string with the copied data. The first character in the source is always at an offset of zero. The offset parameter is optional. If an offset if not given, copying starts with the first character in the source and continues for the specified length.
copy(string source, int length, int offset);
Parameter |
Description |
---|---|
source |
Source of the data to copy. Can be another string object or a literal, enclosed in double quotes. |
length |
The number of characters of data to copy. |
offset (optional) |
Location from which to begin copying data. The first character in a string or literal is always at offset zero. |
Integer. Returns 1 for success, and 0 for failure.
Pointer to object |
Object |
---|---|
|
|
|
|
string mystr;
string new_stuff;
mystr = “abcdefg”;
new_stuff = “123456789”;
mystr.copy(new_stuff, 5, 2);
// mystr now contains "34567"
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |