Qbasicnews.com

Full Version: A small routine to throw in a library somewhere: IsNumeric
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This routine (in c) isn't worth a whole DLL to itself, but if someone has room (or needs it) in a library, feel free to add it.

Code:
int IsNumeric(char *pString){
    char *pEnd;
    double dbl;
    dbl = strtod (pString,&pEnd);
    if (pString != pEnd && *pEnd == '\0'){
        //it is numeric
        return 0;
    }
    else{
        //it isn't
        return -1;
    }
}

I used this command in VB a lot and thought it'd be nice to have in FB.
Hi:

I would like to add this to the library of FreeBASIC functions on my website, if you don’t mind.

Have fun

Garvan
Please, be my guest. Do with it as you will. :-)
Quote:Please, be my guest. Do with it as you will. :-)

Thanks.

Done.

http://www.freewebs.com/weekendcode/DLL_LIB.HTM

Garvan