Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VBScript FormatPercent function


May 13, 2021 VBScript


Table of contents


VBScript FormatPercent function

The VBScript FormatPercent function returns an expression formatted as a percentage (multiplied by 100), ending with the % symbol.


VBScript FormatPercent function Complete VBScript reference manual

The FormatPercent function returns an expression that is formatted as a percentage (following the percentage with the % symbol (multiplied by 100).

Grammar

FormatPercent(Expression[,NumDigAfterDec[,
IncLeadingDig[,UseParForNegNum[,GroupDig]]]])

Parameters

parameter describe
expression Required.It is necessary to format the expression.
NumDigAfterDec Optional.Indicates the value of the number of digits on the right side of the decimal point.The default value is -1 (used by the area setting of the computer).
IncLeadingDig Optional.Indicates whether the leading zero of the small value is displayed:
  • -2 = TristateuseDefault - Using the area of the computer
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False
UseParForNegNum Optional.Indicates whether the negative value is placed in parentheses:
  • -2 = TristateuseDefault - Using the area of the computer
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False
GroupDig Optional.Indicates whether the number packet symbol specified in the computer area setting will group numbers:
  • -2 = TristateuseDefault - Using the area of the computer
  • -1 = TristateTrue - True
  • 0 = TristateFalse - False

Instance 1

'How many percent is 6 of 345?
document.write(FormatPercent(6/345))

Output:

1.74%

Instance 2

'How many percent is 6 of 345?
document.write(FormatPercent(6/345,1))

Output:

1.7%


VBScript FormatPercent function Complete VBScript reference manual