Show: Object Pascal C++
Display Preferences

System.Length

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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 Object Pascal 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
Translations