coldfusion - isNumeric('100e00') returns yes while lsisnumeric('100e00') returns no -
coldfusion - isNumeric('100e00') returns yes while lsisnumeric('100e00') returns no -
i've seen isnumeric('100e00')
returns yes
while lsisnumeric('100e00')
returns no
.
i've checked hex digits (a,b,c,d) returns no them.
does know why considered 100e00
numeric value?
100e00
scientific notation, ie: 100 * 10^0, or: 100.
<cfset string = "100e00"> <cfset numeric = val(string)> <cfoutput> values:<br /> string: #string#<br /> numeric: #numeric#<br /> <hr /> isnumeric()<br /> string: #isnumeric(string)#<br /> numeric: #isnumeric(numeric)#<br /> <hr /> lsisnumeric()<br /> string: #lsisnumeric(string)#<br /> numeric: #lsisnumeric(numeric)#<br /> </cfoutput>
this outputs:
values: string: 100e00 numeric: 100 isnumeric() string: yes numeric: yes lsisnumeric() string: no numeric: yes
the functionality of isnumeric()
, lsisnumeric()
differ beyond locale-awareness of latter.
isnumeric() states this: "determines whether string can converted numeric value" (my emphasis)
lsisnumeric() states: "determines whether string valid representation of number"
do see subtle difference? former seek forcefulness value numeric, whereas latter it's told: tells if it's numeric or not.
coldfusion
Comments
Post a Comment