Text.MaxStrLen(Text) Method
Version: Available or changed with runtime version 1.0.
Gets the maximum defined length of a string variable.
Syntax
MaxLength := Text.MaxStrLen(String: Text)
Note
This method can be invoked without specifying the data type name.
Parameters
String
Type: Text
The string variable for which you want to find the maximum length.
Return Value
MaxLength
Type: Integer
The maximum length of the string variable.
Remarks
If you call this method on a Variant, it returns an error.
Example
var
City: Text[30];
MaxLength: Integer;
Length: Integer;
Text000: Label 'Vedbaek';
Text001: Label 'The MaxStrLen method returns %1,\\';
Text002: Label 'whereas the StrLen method returns %2';
begin
City := Text000;
MaxLength := MaxStrLen(City);
Length := StrLen(City);
Message(Text001 + Text002, MaxLength, Length);
end;
The message window displays the following:
The MaxStrLen method returns 30,
whereas the StrLen method returns 7.