GLBasic forum

Feature request => IDE/Syntax => Topic started by: S. P. Gardebiter on 2010-Dec-01

Title: Isnumber()
Post by: S. P. Gardebiter on 2010-Dec-01
Ich arbeite momentan etwas mit der Commandline. Eine Funktion die überprüft ob ein Wert eine "Zahl" ist oder Buchstaben beinhaltet wäre sehr vorteilhaft D;

Edit: I see, I forget "to english":

I'm currently working with the commandline a bit. A function that checks if a value is a "number" or contains letters would be kinda nice.
Title: Re: Isnumber()
Post by: MrTAToad on 2010-Dec-02
You could check by making sure each character is between 0 and 9, + or - and, if accepting decimal points '.'

Letters would be harder depending on how international you want the check.

It may be easier to just interface with the is isnum and isalpha C commands using INLINE

INLINE
  extern "C" isnum(char one);
  extern "C" isalpha(char one);
ENDINLINE

and then write a function to check each letter for numbers and/or characters