当且仅当此字符串包含指定的char值序列时,java.lang.String.contains()方法才返回true。
public class Sample { public static void main(String args[]){ String str = "Hello how are you welcome to nhooo"; String test = "nhooo"; Boolean bool = str.contains(test); System.out.println(bool); } }
输出结果
true