Returns the maximum defined length of a string variable.
|
MaxLength := MAXSTRLEN(String)
|
Parameters
- String
-
Type: Text constant or code
The string variable for which you want to find the maximum
length.
Property Value/Return Value
Type: Integer
The maximum length of the string variable.
Remarks
Example
This example shows how to use the MAXSTRLEN function.
Assume that City has been defined as a text variable with a maximum
length of 30.
This example requires that you create the following
variables and text constants in the C/AL Globals window.
Variable name |
DataType |
Subtype |
City
|
Text
|
30
|
MaxLength
|
Integer
|
|
Length
|
Integer
|
|
Text constant |
ENU value |
Text000
|
Vedbaek
|
Text001
|
The MAXSTRLEN function returns %1,\
|
Text002
|
while the STRLEN function returns %2
|
|
Copy Code |
City := Text000;
MaxLength := MAXSTRLEN(City);
Length := STRLEN(City);
MESSAGE(Text001 + Text002, MaxLength, Length);
|
The message window displays the following:
The MAXSTRLEN function returns 30,
while the STRLEN function returns 7.
See Also