g
Printer Friendly Version

editor  
BellaOnline's ASP Editor
 

ASP Round Function

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.

ASP Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2023 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor