Szerkesztés

Megosztás a következőn keresztül:


Text.MaxStrLen(Variant) Method

Version: Available or changed with runtime version 1.0 until version 1.0 where it was deprecated.

Gets the maximum defined length of a variant variable.

Syntax

MaxLength :=   Text.MaxStrLen(Variant: Variant)

Note

This method can be invoked without specifying the data type name.

Parameters

Variant
 Type: Variant
The source variant 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.

Text Data Type
Get Started with AL
Developing Extensions