The round function in ASP lets you round a number off to a set number of decimal points. This is great, for example, to round dollar amounts off to the nearest cents.
All you do is use the Round command, and provide the number of decimal points to round it to. For example, if you have a number and want it to have only 2 decimals points so it looks like a dollar value, you would say -
Response.write "Your final total is: $" & Round(CartAmt,2) & " Dollars."
If you want to estimate the number of visitors you get in a given day based on your monthly traffic, you don't want to end up with partial visitors! So in this case you'd round to zero decimal points -
response.write "I get about " & Round(MonthVisit,0) & " visitors each day."
Numeric ASP Functions
|Introduction to ASP Ebook|
Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.