百分比转换数字

String[] str = distributionRatio.split("\\,");//如果(distributionRatio包含多个数)需要拆分
Double i = 0.0;
for(int j=0;j<str.length;j++){
Double b=Double.parseDouble(str[j].replace("%", ""));//如果出错 应该是编码下的%的问题  把前端返回来的%复制在(str[j].replace("%", ""))里面的%就可以了
i = i + b;
}

猜你喜欢

转载自www.cnblogs.com/duoyan/p/11647712.html