/** * 匹配字符串中是否的整数价格和小数价格 * @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+""; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。