VBScript FormatPercent Function
--
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
VBScript Tutorial
VB TutorialVB UsageVB VariablesVB ProceduresVB ConditionalsVB LoopsVB SummaryVB ExamplesVB FunctionsVB Keywords
Deep Dive
Software
Web Services
Computer
Web Service
Programming
Programming Languages
Computer Science
Computers
Scripting Languages
Web Design and Development
VBScript FormatPercent Function
Complete VBScript Reference Manual
The FormatPercent function returns an expression formatted as a percentage (multiplied by 100) with a trailing % sign.
Syntax
FormatPercent(Expression[,NumDigAfterDec[,
IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
| Parameter | Description |
|---|---|
| expression | Required. The expression to be formatted. |
| NumDigAfterDec | Optional. A numeric value indicating how many digits to display to the right of the decimal point. Default is -1 (uses the computer's regional settings). |
| IncLeadingDig | Optional. Indicates whether to display a leading zero for fractional values: * -2 = TristateUseDefault - Uses the computer's regional settings * -1 = TristateTrue - True * 0 = TristateFalse - False |
| UseParForNegNum | Optional. Indicates whether to enclose negative numbers in parentheses: * -2 = TristateUseDefault - Uses the computer's regional settings * -1 = TristateTrue - True * 0 = TristateFalse - False |
| GroupDig | Optional. Indicates whether to group digits using the digit grouping symbol specified in the computer's regional settings: * -2 = TristateUseDefault - Uses the computer's regional settings * -1 = TristateTrue - True * 0 = TristateFalse - False |
Example 1
'How many percent is 6 of 345? document.write(FormatPercent(6/345)) Output: 1.74%
Example 2
'How many percent is 6 of 345? document.write(FormatPercent(6/345,1)) Output: 1.7%
YouTip