I’ve just seen that isNumeric('100e00') returns yes while lsisnumeric('100e00') returns no.
I’ve checked another hex digits (a,b,c,d) but it returns no with them.
Does anyone know why is it considered 100e00 as a numeric value?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
100e00is scientific notation, ie: 100 * 10^0, or: 100.This outputs:
The functionality of
isNumeric()andlsIsNumeric()differ slightly beyond the locale-awareness of the latter.isNumeric() states this:
“Determines whether a string can be converted to a numeric value”
(my emphasis)
lsIsNumeric() states:
“Determines whether a string is a valid representation of a number”
Do you see the subtle difference? the former will try to force the value to be a numeric, whereas the latter just does what it’s told: tells you if it’s a numeric or not.