ITPub博客

首页 > > > java 正则表达式提取价格

java 正则表达式提取价格

作者:longmanma 时间:2019-12-31 09:30:44 0 删除 编辑

实例代码:

publicstaticvoid main(String[] args) {

String str="11000.00元";

Pattern pattern = Pattern.compile("(\\d+(\\.\\d+)?)");

Matcher matcher = pattern.matcher(str);

if (matcher.find()) {

System.out.println(matcher.group(1));

}

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2730/viewspace-3146774/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-12-18

  • 博文量
    492
  • 访问量
    11986