@@ -0,0 +1,2159 @@
+/*%0A * Key point: using %22e%22 as delimiter to split string %0A *   and then valid base and power parts separtely.%0A *%0A * Lession: s.trim() return a new string which is trimmed%0A *  ? may be String.split() has a bug, refer to line 17%0A */%0A%0Apublic class Solution %7B%0A    public boolean isNumber(String s) %7B%0A        s = s.trim();%0A        //s is empty or only has spaces or end with 'e' is false%0A        if(s.length() == 0 %7C%7C (s.length() %3E 0 && s.charAt(s.length()-1) == 'e'))%0A            return false;%0A            %0A        //using %22e%22 as delimiter%0A        //? may be there is a bug%0A        //when s is %22e9%22 s.split() will return two Strings%0A        //the first one is an empty String, the second is %229%22%0A        //have to eliminate empty string at line 44    %0A        String%5B%5D splitted = s.split(%22e%22);%0A        if(splitted.length %3E 2)%0A            return false;%0A            %0A        boolean baseResult = isValid(splitted%5B0%5D, false);%0A        boolean powResult = true;%0A        %0A        if(splitted.length == 2)%0A            powResult = isValid(splitted%5B1%5D, true);%0A            %0A        return baseResult && powResult;%0A    %7D%0A    %0A    //boolean argument hasPoint indicate whether has point%0A    public boolean isValid(String s, boolean hasPoint)%7B%0A        if(s.length() %3E 0 && (s.charAt(0) == '+' %7C%7C s.charAt(0) == '-'))%0A            s = s.substring(1);%0A        %0A        char%5B%5D charArray = s.toCharArray();%0A        %0A        //checking charArray.length == 0 because String.split() methed%0A        //will return an empty string when delimiter appear at the very%0A        //first of String, not sure if it's a bug of String.split()%0A        //refer to comment at line 14%0A        if (charArray.length == 0 %7C%7C s.equals(%22.%22))%0A            return false;%0A        %0A        for (int i = 0; i %3C charArray.length; i++) %7B%0A            if (charArray%5Bi%5D == '.') %7B%0A                if (hasPoint)%0A                    return false;   //meet point again,return false%0A                hasPoint = true;    //first meet point, set hasPoint true%0A            %7D %0A            else if (!('0' %3C= charArray%5Bi%5D && charArray%5Bi%5D %3C= '9')) %7B%0A                return false;%0A            %7D%0A        %7D%0A%0A        return true;%0A    %7D%0A%7D

add Valid Number