java中判断字符串a包含字符串b

[html]  view plain  copy
  1. public static boolean judge(String[] str) {  
  2. for (int i = 0; i < str.length - 1; i++) {  
  3. char[] ca = str[i].toCharArray();  
  4. char[] ca2 = str[i+1].toCharArray();  
  5. for (int j = 1; j < ca.length; j++) {  
  6. for (int j2 = 0; j2 < ca2.length; j2++) {  
  7. if(ca[j] == ca2[j2]){  
  8. System.out.println("String str");  
  9. return true;  
  10. }  
  11. }  
  12. }  
  13. }  
  14. return false;  

猜你喜欢

转载自blog.csdn.net/xiaoyutongxue6/article/details/79893544