procedure CopyTo(const SourceIndex: Integer; var Destination: array of Char; const DestinationIndex, Count: Integer);
Copies Count characters from SourceIndex into Destination at DestinationIndex.
| # | Name | Description |
|---|---|---|
| 1 | SourceIndex | The first character copied, 0-based. |
| 2 | DestinationIndex | The first element written, 0-based. |
Result: stored in self (calling object)
Remarks:
Both ranges must lie inside their arrays, else ESubstringRangeError is raised.
Examples
Characters into an array.
uses Substr;
procedure Example;
var Buf: array[0..4] of Char;
s: Substring;
begin
s := Substring('hello');
s.CopyTo(1, Buf, 1, 3);
Assert(Buf[1] = 'e');
Assert(Buf[3] = 'l');
end;