Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic, Web
Expertise: All
Jul 22, 1999



Application Security Testing: An Integral Part of DevOps

Display Small Decimals Using VBScript

It is common to have online survey results posted via an ASP page. While for the most part it will work fine, you have to be careful when your results contain small irrational numbers. For small irrational numbers, ASP automatically returns the number in scientific notation. To avoid this result, use either the FormatPercent or the FormatNumber function. Conveniently, the FormatPercent function will multiply your result by 100. For example, this code:

Response.Write "<P>" & 5 / 50025 * 100 & "%"
Response.Write "<P>" & FormatPercent(5 / 50025, 4) '4 digits after decimal point
Response.Write "<P>" & FormatNumber(5 / 50025, 4) '4 digits after decimal point

will produce:

William Wen
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date