java中正则表达式过滤字符串
public class Test { public static void main(String[] args) { System.out.println(regexReplace("test","test"));; Person person = new User(); System.out.println(person.getName()); } public static int regexReplace(String strAim, String strPart){ Pattern p = null; Matcher m = null; int count = 0; p = Pattern.compile(strPart); m = p.matcher(strAim); while (m.find()) { count++; } return count; } }
相关推荐
wangzhaotongalex 2020-10-20
wyq 2020-11-11
TLROJE 2020-10-26
风雨断肠人 2020-10-13
duanqingfeng 2020-09-29
rechanel 2020-11-16
cshanzhizi 2020-10-16
luofuIT成长记录 2020-09-22
phphub 2020-09-10
taomengxing 2020-09-07
MaggieRose 2020-08-19
flyingssky 2020-08-18
山水沐光 2020-08-18
jyj00 2020-08-15
AHuqihua 2020-08-09
山水沐光 2020-08-03