笔趣阁

字:
关灯 护眼
笔趣阁 > 我的1979 > 116、骂战

116、骂战

        matcher=pattern.matcher(string);

        NumberFormatnumberFormat=NumberFormat.getInstance();

        }

        055

        054

        try{

        temp=matcher.group();

        Matchermatcher=null;

        073

        089

        }catch(NumberFormatExceptione){

        064

        074

        returnstring;

        string=string.substring(0,index)

        while(pattern.matcher(string).find()){

          computeStirngNoBracket(temp)

        }

        096

        s=decimalFormat.format(obj);

        }else{

        if(!Pattern.matches(regexCheck,string))

          string.substring(index  temp.length());

        072

        058

        intindex=-1;

        returns;

        061

        067

        053

        083

        068

        string=string.replaceAll(“\\s“,““);//去除空格

        084

        StringregexCheck=“[\\(\\)\\d\\  \\-\\*/\\.]*“;//是否是合法的表达式

        060

        Stringregex=“\\([\\d\\.\\  \\-\\*/]  \\)“;//提取括号表达式

        while(matcher.find()){

at(obj);

        index=string.indexOf(temp);

        069

        056

        082

        DecimalFormatdecimalFormat=newDecimalFormat(format);

        059

        071

        090

        string=computeStirngNoBracket(string);

        085

        s=numberFormat.format(obj);

        }else{

        086

        094

        //最后计算总的表达式结果

        Stringtemp=““;

        065

        */

        //循环计算所有括号里的表达式

        095

        057

        *计算字符串四则运算表达式

        077

        081

        publicstaticStringcomputeString(Stringstring){

        /**

        066

        070

        }catch(Exceptione){

        076

        062

        093

        079

        080

        returne.getMessage();(未完待续。)

        091

        092

        088

        }

        078

        075

        }

        }

        Patternpattern=Patternpile(regex);

        *@paramstring

        *@return

        063

        097

        }

        052

        087

【1】【2】

『加入书签,方便阅读』
热门推荐
剥削好莱坞1980 植物人五年,觉醒当场看到妻子被欺负 美食从麻婆豆腐开始 破碎虚空,绝世剑仙从书中走出 离婚后,我修仙归来的身份曝光 带着签到系统去古代:后娘不好惹