MAXSTRLEN Function (Code, Text)
Microsoft Dynamics NAV 2015
Gets 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.
This example requires that you create the following variables and text constants in the C/AL Globals window.
| Variable name | DataType | Length |
|---|---|---|
|
City |
Text |
30 |
|
MaxLength |
Integer |
Not applicable |
|
Length |
Integer |
Not applicable |
| Text constant | ENU value |
|---|---|
|
Text000 |
Vedbaek |
|
Text001 |
The MAXSTRLEN function returns %1,\ |
|
Text002 |
whereas the STRLEN function returns %2 |
City := Text000; MaxLength := MAXSTRLEN(City); Length := STRLEN(City); MESSAGE(Text001 + Text002, MaxLength, Length);
The message window displays the following:
The MAXSTRLEN function returns 30,
whereas the STRLEN function returns 7.
Show: