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.


Our Top 10 Tips for Classic ASP : Page 8

Tidy up your server-side programming techniques with these 10 great tricks for classic ASP.




Application Security Testing: An Integral Part of DevOps

Formatting Numbers for Display

One unexpected feature of VBScript for VB programmers making the change to ASP is that the familiar Format function is missing. So how do you format numbers the way you want them instead of the way they are stored in the database--for example, as a percentage, as a currency, or even with decimal places? Use the code in this example which shows you how to use the new FormatXXXXX functions that replace the VB Format function.

On a particular page in the application I'm developing, I'd like to display some numbers, in ####.#### format. How do I go about doing that in ASP?

Use the FormatNumber function in VBScript. This returns an expression formatted as a number.

Syntax: FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

For example, FormatNumber("123.45",4) would return 123.4500

Check the VBScript help at http://msdn.microsoft.com/scripting for more info.

Comment and Contribute






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



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date