表示数值的字符串

class Solution {
public:
    bool isNum(char *ch)
        {
        if(*ch<='9'&&*ch>='0')
            return true;
        else return false;
    }
    bool isNumeric(char* string)
    {
        if(string==NULL)
            return false;
        if(*string=='+'||*string=='-')
            string++;
        if(*string=='')
                return false;
        while(*string!='')
            {
            if(*string=='.'||*string=='e'||*string=='E')
                 break;
             else if(isNum(string))
                 string++;
                else return false;
             
        }
        if(*string=='.')
            {
            string++;
  
            while(*string!='')
            {
             if(isNum(string))
                 string++;
             else if(*string=='e'||*string=='E') 
                 break;
                 else return false;
        }
        }
        if(*string=='e'||*string=='E')
            {
            string++;
            if(*string=='')
                return false;
            if(*string=='+'||*string=='-')
            string++;
            if(*string=='')
                return false;
             while(*string!='')
            {
                if(isNum(string))
                 string++;
                else return false;    
        }
            
        }
        return true;
    }

};
原文地址:https://www.cnblogs.com/daocaorenblog/p/5445820.html