js中:

varCts = "aaddssyes";

if(Cts.indexOf("yes") > 0 ){

    alert('Cts中包含Text字符串');

}

找的是最开始的位置,如果没找到,则返回的是-1.

 

functionIndexDemo(str){

   varstr1 = "BABEBIBOBUBABEBIBOBU"

   vars = str1.indexOf(str);

   return(s);

}

str是外边传来的一个字符串

 
 
java中:
 
public static void main(String[] args) { 
String str="ABC_001"; 
if(str.indexOf("ABC")!=-1){  
System.out.println("包含"); 
}else{ System.out.println("不包含"); 
}

相关文章:

  • 2021-07-25
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2022-02-28
猜你喜欢
  • 2022-01-08
  • 2022-01-07
相关资源
相似解决方案