package com.yanshu.tools;
public class Test1 {
public static void main(String[] args) {
String str="https://s.taobao.com/search?cat=54900006&q=FLAM";
if(str.indexOf("ajax")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}
}
}
public class Test1 {
public static void main(String[] args) {
String str="https://s.taobao.com/search?cat=54900006&q=FLAM";
if(str.indexOf("ajax")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}
}
}

本文介绍了一个简单的Java程序,用于检查一个字符串是否包含特定子串。通过使用indexOf方法,程序能够判断给定的URL是否包含'ajax'字样,并据此打印出相应的结果。
234

被折叠的 条评论
为什么被折叠?



