num2Str Function
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Converts a real number to a string.
str num2Str(
real number,
int character,
int decimals,
int separator1,
int separator2)
Parameters
Parameter |
Description |
---|---|
number |
The real number to convert to a string. |
character |
The minimum number of characters required in the text. |
decimals |
The required number of decimal places. |
separator1 |
A DecimalSeparator enumeration value. |
separator2 |
A ThousandSeparator enumeration value. |
Return Value
A string that represents the number.
Remarks
For the decimals parameter, the maximum value is 16. If a larger number is used, this method instead obtains a value for the decimals parameter from the local computer. In both cases rounding does occur.
Possible enumeration values for the separator1 parameter are:
1 – point (.)
2 – comma (,)
Possible values for the separator2 parameter are:
0 – no thousands separator
1 – point (.)
2 – comma (,)
3 – space ( )
Example
In the following code example, the first call to the num2str method provides 16 for the decimals parameter, and the second provides 17.
static void Job_Num2Str(Args _args)
{
real realNum = 0.1294567890123456777; // 19 decimals places.
;
info(Num2Str(realNum,0,16,1,3)); // 16 decimal places
info(Num2Str(realNum,0,17,1,3)); // 17 decimal places
}
Output
The messages are in the following Infolog output. The first number in the display contains 16 decimal place digits, whereas the second contains only 2.
Message (10:18:12)
0.1294567890123457
0.13
See also
Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).