字体:大 中 小
护眼
关灯
上一页
目录
下一章
116、骂战 (第3/3页)
> 069 */ 070 publicstaticStringcomputeString(Stringstring){ 071 StringregexCheck=“[\\(\\)\\d\\ \\-\\*/\\.]*“;//是否是合法的表达式 072 073 if(!Pattern.matches(regexCheck,string)) 074 returnstring; 075 076 Matchermatcher=null; 077 Stringtemp=““; 078 intindex=-1; 079 Stringregex=“\\([\\d\\.\\ \\-\\*/] \\)“;//提取括号表达式 080 string=string.replaceAll(“\\s“,““);//去除空格 081 try{ 082 Patternpattern=Patternpile(regex); 083 //循环计算所有括号里的表达式 084 while(pattern.matcher(string).find()){ 085 matcher=pattern.matcher(string); 086 while(matcher.find()){ 087 temp=matcher.group(); 088 index=string.indexOf(temp); 089 string=string.substring(0,index) 090 computeStirngNoBracket(temp) 091 string.substring(index temp.length()); 092 } 093 } 094 //最后计算总的表达式结果 095 string=computeStirngNoBracket(string); 096 }catch(NumberFormatExceptione){ 097 returne.getMessage();(未完待续。)
上一页
目录
下一章
相关推荐:(足球乙女np)采蘑菇的小女孩 , 唯一 , 篡夺女婿的坏母亲 , 蜜桃奶酪(1v2) , 江湖郎中治不了精分(女尊 人外 h) , 朝阳似月(1v1h) , 兼职(1v1,强制,sc) , 情难自禁(1v1 年龄差) , 堕落男女 , 幸福家庭(母子哨向赛博 1v2) , 受虐癖 , 新婚娇妻穿着婚纱在醉酒老公旁边被公公后入