假如有字符串“6sabcsssfsfs33” ,用最有快速的方法去掉字符“ab3”,不能用java内置字符串方法(indeOf,substring,replaceAll等)?

来源:互联网 发布:淘宝授权品牌要钱吗 编辑:程序博客网 时间:2024/06/05 19:13

String regx = "[^a|b|3]";
  String temp = "6sabcsssfsfs33";
  Pattern p = Pattern.compile(regx);
  Matcher m = p.matcher(temp);
  while (m.find()) {
   System.out.print(m.group());
  }

原创粉丝点击