1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit


string handling routines

function Copy(S; Index, Count: Integer): string;
function Copy(S; Index, Count: Integer): array;

Returns a substring of a string or a segment of a dynamic array.
S is an expression of a string or dynamic-array type. Index and Count are integer-type expressions. Copy returns a string containing a specified number of characters from a string or sub array containing Count elements starting at S[Index].

If Index is greater than the length of S, Copy returns a zero-length string ("") or an empty array.
If Count specifies more characters or array elements than are available, only the characters or elements from S[Index] to the end of S are returned.

To determine the number of characters in string, use the Length function. A convenient way to copy all the elements of S from the starting Index is to use MaxInt as Count.

var s : string;

s := Copy(s,2,3);

in real code
String Types in Delphi
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.
Arrays in Object Pascal
Understanding and using array data types in Delphi.
Traveling Label
Spice up your user interface with a marquee style text. Use marquee style text to display scrolling text that you want to catch your Delphi program users' attention.

see also
Delete, Insert, Length, Concat, Pos, Slice,

©2015 About.com. All rights reserved.