Author Topic: Isnumber()  (Read 2390 times)

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 247
    • View Profile
    • Tile 44 Interactive
« 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.
« Last Edit: 2010-Dec-01 by S. P. Gardebiter »
~ Cave Story rules! ~


  • Guest
Re: Isnumber()
« Reply #1 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

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

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