标签:ISE lis The lse mon git str number 正则表达
/**
* 匹配字符串中是否的整数价格和小数价格
* @param str
* @return
*/
public static String Match_the_amount(String str) {
String pattern[] = {"[1-9]\\d*\\u5143|[1-9]\\d*.\\d*\\u5143|0.\\d*[1-9]\\d*\\u5143|"
+ "[1-9]\\d*\\u4e07|[1-9]\\d*.\\d*\\u4e07|0.\\d*[1-9]\\d*\\u4e07|"
+ "[1-9]\\d*\\u5341\\u5143|[1-9]\\d*.\\d*\\u5341\\u5143|0.\\d*[1-9]\\d*\\u5341\\u5143|"
+ "[1-9]\\d*\\u767e\\u5143|[1-9]\\d*.\\d*\\u767e\\u5143|0.\\d*[1-9]\\d*\\u767e\\u5143|"
+ "[1-9]\\d*\\u5343\\u5143\\u000d\\u000a|[1-9]\\d*.\\d*\\u5343\\u5143\\u000d\\u000a|0.\\d*[1-9]\\d*\\u5343\\u5143\\u000d\\u000a|"
+ "[1-9]\\d*\\u4e07\\u5143\\u000d\\u000a|[1-9]\\d*.\\d*\\u4e07\\u5143\\u000d\\u000a|0.\\d*[1-9]\\d*\\u4e07\\u5143\\u000d\\u000a|"};
List<String> olist = new ArrayList<String>();
olist = stringFun_money(str, pattern);
double money = 0;
for(int i = 0 ; i <olist.size();i++){
if(Appear_String.IsExit("万",olist.get(i))){
money = Double.parseDouble(DigitUtil.getNumber(olist.get(i)));
money = money*10000;
}else if(Appear_String.IsExit("万元",olist.get(i))){
money = Double.parseDouble(DigitUtil.getNumber(olist.get(i)));
money = money*10000;
}else if(Appear_String.IsExit("千元",olist.get(i))){
money = Double.parseDouble(DigitUtil.getNumber(olist.get(i)));
money = money*1000;
}else if(Appear_String.IsExit("百元",olist.get(i))){
money = Double.parseDouble(DigitUtil.getNumber(olist.get(i)));
money = money*100;
}else if(Appear_String.IsExit("元",olist.get(i))){
money = Double.parseDouble(DigitUtil.getNumber(olist.get(i)));
}
}
return money+"";
}
标签:ISE lis The lse mon git str number 正则表达
原文地址:https://www.cnblogs.com/java-h/p/10584021.html