不多说直接上代码
例如:
public static boolean isHave(String strs, String s) {
for (int i = 0; i < strs.length(); i++) {
if (strs.indexOf(s) != -1) {
return true;
}
}
return false;
}
假设:
String strs = abdc fsad fa fs 123 dahflsa ;
如果:
String s = 123;
结果返回true;
如果:
String s = 456;
结果返回false;