use regex libraryimport java.util.regex.*;class TestReg
{ public static void main(String[] args)
{
String s = "abc def Where x y z";
Pattern p = Pattern.compile("where\\s+x\\s+y\\s+z", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(s);
if (m.find())
System.out.println("in");
else
System.out.println("not in");
}
}
{ public static void main(String[] args)
{
String s = "abc def Where x y z";
Pattern p = Pattern.compile("where\\s+x\\s+y\\s+z", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(s);
if (m.find())
System.out.println("in");
else
System.out.println("not in");
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货