/ Published in: ASP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<% 'IsNumeric evaluates TRUE both integers and real numbers. 'You shouldn't rely on this function at all. 'Depending on your Locale ID (LCID) and what character is used 'as a decimal delimiter (, or .) it may mis-evaluate real numbers! 'For example" Session.LCID=1049 Response.Write(IsNumeric("10.5")) 'FALSE Response.Write(IsNumeric("10,5")) 'TRUE Response.Write(IsNumeric("10. 5")) 'FALSE Response.Write(IsNumeric("10, 5")) 'TRUE, assumes it's 10,5 Session.LCID=1033 Response.Write(IsNumeric("10.5")) 'TRUE Response.Write(IsNumeric("10,5")) 'TRUE, assumes it's 105.00 Response.Write(IsNumeric("10. 5")) 'FALSE Response.Write(IsNumeric("10, 5")) 'FALSE 'It get's even worse when you try to evaluate Query String: 'http://www.website.com/page.asp?number=10&number=20 Session.LCID=1049 IsNumeric(Request.QueryString("number")) 'TRUE 'Evaluates TRUE because it returns IStringList with the following 'comma-delimited values "10, 20" and IsNumeric believes it's a real number %>