正则表达式判断是否包含一个字符串
答案:1 悬赏:0
解决时间 2021-01-19 21:44
- 提问者网友:山高云阔
- 2021-01-19 16:06
正则表达式判断是否包含一个字符串
最佳答案
- 二级知识专家网友:酒醒三更
- 2021-01-19 16:34
用java正则表达式检测字符串中含有某字符方法:
public class Test {
public static void main(String[] args) {
String str="Hello World"; //待判断的字符串
String reg=".*ll.*"; //判断字符串中是否含有ll
System.out.println(str.matches(reg));
}
}
public class Test {
public static void main(String[] args) {
String str="Hello World"; //待判断的字符串
String reg=".*ll.*"; //判断字符串中是否含有ll
System.out.println(str.matches(reg));
}
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯