length

length(): Integer;

The length method of the String primitive type returns the actual length of the value that has been assigned to an embedded String property; for example, if you declared a String property with length of 30 but the value stored is of length 20, the length method returns 20.

The following example shows the use of the length method.

vars
    stringValue : String;
begin
    stringValue := 'hello world';
    write stringValue.length;     // Outputs 11
end;