Revision: 28921
Updated Code
at July 16, 2010 07:05 by Shurik76
Updated Code
<%
'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
%>
Revision: 28920
Updated Code
at July 16, 2010 06:54 by Shurik76
Updated Code
<%
'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
Session.LCID=1033
Response.Write(IsNumeric("10.5")) 'TRUE
Response.Write(IsNumeric("10,5")) 'TRUE
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
%>
Revision: 28919
Updated Code
at July 16, 2010 05:50 by Shurik76
Updated Code
<%
'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
Session.LCID=1033
Response.Write(IsNumeric("10.5")) 'TRUE
Response.Write(IsNumeric("10,5")) 'TRUE
'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
%>
Revision: 28918
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 16, 2010 05:36 by Shurik76
Initial Code
<%
'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
Session.LCID=1033
Response.Write(IsNumeric("10.5")) 'TRUE
Response.Write(IsNumeric("10,5")) 'TRUE
'It get's even worse when you try to evaluate Query String:
'http://www.website.com/page.asp?number=10&number=20
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
%>
Initial URL
Initial Description
Initial Title
Beware of IsNumeric
Initial Tags
Initial Language
ASP