用java正则表达式检测字符串中是否含有某字符

如题所述

public class Test {

public static void main(String[] args) {
String str="Hello World"; //待判断的字符串
String reg=".*ll.*"; //判断字符串中是否含有ll
System.out.println(str.matches(reg));
}
温馨提示:答案为网友推荐,仅供参考