[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# TStringHelper.ToCharArray

Return the string as an array of characters.

## Declaration

Source position: syshelph.inc line 182

`public function TStringHelper.ToCharArray: TCharArray; overload; function TStringHelper.ToCharArray(`
`AStartIndex: SizeInt;`
`ALen: SizeInt`
`):TCharArray; overload;`

## Description

ToCharArray returns part of the string (Self) as an array of characters. The characters are copied starting at (zero-based) index AStartIndex and at most ALen characters are copied. If AStartIndex and ALen are omitted, all the characters are returned.

## Errors

If AStartIndex is less than zero, an EAccessViolation exception may be raised.

## See also

TStringHelper.Substring |  | Return a part of the string
TStringHelper.Insert |  | Insert a string at a given position
Copy |  | Copy part of a string.