[Gambas-user] Inbuilt function to check if a string contains a valid number

2011-07-26 Thread vikram
Hi,

Is there an inbuilt function in Gambas 2 (2.21) to check if a string contains a 
valid number?


Thanks,
Vikram Nair
--
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Inbuilt function to check if a string contains a valid number

2011-07-26 Thread Benoît Minisini
 Hi,
 
 Is there an inbuilt function in Gambas 2 (2.21) to check if a string
 contains a valid number?
 
 
 Thanks,
 Vikram Nair

No, but you can do that:

DIM MyNumber AS Float
TRY MyNumber = Val(MyString)
IF ERROR THEN PRINT Not a valid number

In Gambas3, IsNumber() does what you want. But not in Gambas 2, beware!

-- 
Benoît Minisini

--
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user