Rick ...
I've read this response a number of times, and understand the message you
attempting to present, however I believe the example
ReturnValue = IsNumeric("($1,23,,3.4,,,5,,E67$)")
.... and the statement "Most people would not expect THAT to return True." is
not quite correct. Your statement ***umes the developer viewing the
complexity and formatting of the expression would expect a False result.
One of the MSDN definitions for IsNumeric indicates it will return True if
the value p***ed is a string _and_ that string can be successfully converted
to a double. This is the case for the above ...
Print CDbl("($1,23,,3.4,,,5,,E67$)")
Thus, given the MSDN inputbox entry example:
Do
anyNumber = InputBox("Enter a number")
Loop Until IsNumeric(anyNumber)
.... the loop would properly terminate when the string above was entered.
While your example may be representative of what may, upon first
examination, be perceived as a string that should fail the IsNumeric test, I
believe the MSDN example of using :
ReturnValue = IsNumeric("45 some text here")
remains a better (and clearer) example showing the possibility of misusing
IsNumeric against a string containing a numeric value where the user may
interpret that any variable that p***es a Val() test should p*** an
IsNumeric() test.
My intention is not to represent IsNumeric as being a better test than any
other available methods for determining whether a value is a valid number,
just that the complexity of a valid string does not negate the benefit of
using IsNumeric as judiciously as any other function would be used.
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.