VBScript FormatCurrency
Function
The FormatCurrency
function returns an expression formatted as a currency value using the currency symbol defined in the computer system's control panel.
Syntax
Parameter | Description |
---|---|
expression | Required. The expression to be formatted. |
NumDigAfterDec | Optional. A numeric value indicating the number of digits to display after the decimal point. The default is -1 (uses the computer's regional settings). |
IncLeadingDig | Optional. Indicates whether to display a leading zero for decimal values: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False |
UseParForNegNum | Optional. Indicates whether to place negative values in parentheses: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False |
GroupDig | Optional. Indicates whether to group numbers using the digit grouping symbol specified in the computer's regional settings: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False |
Example
Example 1
Output result of the above example:
Example 2
Setting the number of digits after the decimal point:
Output result of the above example:
Example 3
Displaying a leading zero for decimal values:
Output result of the above example:
Example 4
Placing negative values in parentheses:
Output result of the above example:
Example 5
Grouping a million dollars:
Output result of the above example: