054
s=(obj);
055
}
056
}else{
057
numberformatnumberformat=();
058
s=(obj);
059
}
060
}catch(exceptione){
061
}
062
retus;
063
}
064
065
070
publicstaticstringcomputestring(stringstring){
071
stringregexcheck=“[\\(\\)\\d\\+\\-\\*/\\]*“;是否是合法的表达式
072
073
if(!(regexcheck,string))
074
retustring;
075
076
matchermatcher=null;
077
stringtemp=““;
078
intindex=-1;
079
stringregex=“\\([\\d\\\\+\\-\\*/]+\\)“;提取括号表达式
080
string=(“\\s“,““);去除空格
081
try{
082
pattepatte=(regex);
083
循环计算所有括号里的表达式
084
while((string)()){
085
matcher=(string);
086
while(()){
087
temp=();
088
index=(temp);
089
string=(0,index)
090
+computestignobracket(temp)
091
+(index+());
092
}
093
}
094
最后计算总的表达式结果
095
string=computestignobracket(string);
096
}catch(numberformatexceptione){
097
();
(未完待续。)手机用户请浏览阅读,更优质的阅读体验。