ASP/VBScript FormatPercent() Returns an expression formatted as a percentage (multiplied by 100) with a trailing % character.
ShotDev Focus:
- Using Asp and FormatPercent() function.
Syntax
<% FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) %>
Example
asp_formatpercent.asp
<% Option Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Response.write FormatPercent("1.2345",3)&"<br>" Response.write FormatPercent("0.5678",3)&"<br>" Response.write FormatPercent("12.5678",1)&"<br>" Response.write FormatPercent("45.5678",2)&"<br>" Response.write FormatPercent("67.5678",3)&"<br>" %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_formatpercent.asp
Screenshot