Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

isNumeric?

Status
Not open for further replies.

blueindian1

Programmer
Apr 24, 2001
150
US
Hi,

Is there a function in ASP that can tell me if a character is numeric? Something to VB's IsNumeric function?

Thanks,

Rich
 
Hi blueindian1,

I use IsNumeric in VB Script, but one thing you should be aware of (sorry if you already do!)

In MSDN:
"IsNumeric returns True if the ENTIRE expression is recognized as a number; otherwise, it returns False."


IsNumeric uses the regional settings in the control panel for determining valid numbers (i.e formats like 123,000 etc.). Even if you server has the appropriate settings you can still get problems when commas are invovled.

For example our setting is English(UK) and when I test the condtions:-

IsNumeric ("34,55,66,") and more extreme,
IsNumeric ("3456,34,,,,,56")

they are classed as Numeric But in my view ARE NOT because I can't see how the ENTIRE Expression can be evaluated as a number. Anyways I created a custom IsNumber Function, and used IsNumeric in it as a primary filter, then added more checking when commas are invovled.

Regards,

Codefish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top