Talk:Determine if a string is numeric: Difference between revisions
Content added Content deleted
(Unix shell) |
(Exact definition of IsNumeric?) |
||
Line 12: | Line 12: | ||
fi |
fi |
||
</pre> |
</pre> |
||
== Exact definition of IsNumeric? == |
|||
For those who don't know VB: How exactly is IsNumeric defined? |
|||
For example: Is leading/trailing whitespace allowed (i.e. " 123" or "123 ")? |
|||
Does it also accept floting point values (e.g. "2.5" or "1e5")? |
|||
What about thousands separators (e.g. "10,000")? Is that locale-dependent? |
|||
Are numbers in other bases (e.g. hexadecimal) allowed (assuming VB supports them otherwise)? |
|||
What about numbers too big to fit into a native integer (e.g. "9999999999999999999999999999999999999999999999999") resp. a native float (e.g. "1e1234567")? |
Revision as of 15:23, 28 February 2007
Unix shell
#!/bin/sh a='123' if [ "$a" -eq "$a" ] 2>/dev/null then echo "a is numeric" else echo "a is abnumeric" fi
Exact definition of IsNumeric?
For those who don't know VB: How exactly is IsNumeric defined? For example: Is leading/trailing whitespace allowed (i.e. " 123" or "123 ")? Does it also accept floting point values (e.g. "2.5" or "1e5")? What about thousands separators (e.g. "10,000")? Is that locale-dependent? Are numbers in other bases (e.g. hexadecimal) allowed (assuming VB supports them otherwise)? What about numbers too big to fit into a native integer (e.g. "9999999999999999999999999999999999999999999999999") resp. a native float (e.g. "1e1234567")?