Isnumber()

Previous topic - Next topic

S. P. Gardebiter

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.
~ Cave Story rules! ~

MrTAToad

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