A More Convenient cInt
page 2 of 2
by Dan Powderhill
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 19243/ 36
Article Contents:

cInt2 Function

The function below, cInt2, does just that and can be used in the same way as the regular cInt function.

function cInt2(strInput)
     'Remove any trailing or leading spaces
     strInput = trim(strInput)

     'If the input is null, blank, or not a number then set it to zero
     if strInput = "" or isNull(strInput) or not isNumeric(strInput) then strInput = "0"

     ' Convert it to an integer using the regular cInt function and return it.
     cInt2 = cInt(strInput)
end function

This function could also be adapted to cater for converting the “on” value passed by checked checkboxes to a given integer.


View Entire Article

User Comments

Title: Great stuff!!   
Name: Peter
Date: 2008-11-11 7:42:05 AM
Comment:
Thanks so much - saved me time (that I dont have) in resolving this issue!! Beautiful.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-12-11 7:40:32 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search