Show: Delphi C++
Display Preferences

System.Length

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Length(S: <string or dynamic array>): Integer;

Properties

Type Visibility Source Unit Parent
function public System.pas System System

Description

Returns the number of characters in a string or of elements in an array.

In Delphi code, Length returns the number of characters actually used in the string or the number of elements in the array. In C++ code, use the method of the same name on the AnsiString or DynamicArray class.

S is a string-valued or array-valued expression.

For single-byte and multibyte strings, Length returns the number of bytes used by the string. Example for UTF-8:

Writeln(Length(Utf8String('1¢'))); // displays 3

For Unicode (WideString) strings, Length returns the number of bytes divided by two.

See Also

Code Examples

Personal tools
In Other Languages
Previous Versions
Assistance