[Gambas-user] IsNumber question
gambas at ...1...
Fri May 13 11:36:29 CEST 2005
On Friday 13 May 2005 09:27, nando wrote:
> I have a question with TEXTAREA
> TextArea1.Text = "349"
> PRINT IsNumber(TextArea1.Text)
> produces FALSE
> I was presuming from Wiki that
> IsNumber tested an expression.
> Of course 349 is a string
> but it also vals to a valid number.
> It would seem that IsNumber only looks at the type of var
> without doing the internally VAL - perhaps as designed.
> Performing the VAL would help determine if a string VAL'd
> to a valid number.
> Yes, I could code it, but is seemed IsNumber ought to do that.
> How would IsNumber be used without VAL at the same time?
IsNumber() just tests the type of the value (from boolean to float). It does
not behave like IsNumber() in VB.
To know if a string is a number, you must use Val()/CInt()/CFloat() and test
if you get an error.
mailto:gambas at ...1...
More information about the User