A More Convenient cInt
page 2 of 2
by Dan Powderhill
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 16045/ 32
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
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-2024 ASPAlliance.com  |  Page Processed at 2024-06-18 4:08:49 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search