最简单的就是:  String s = "AABBCC";
               if( s.indexOf("BB"))
                   {
                      ....
                    }

解决方案 »

  1.   

    indexOf方法
    String s = "AABBCC";
    int i = s.indexOf("BB");
    indexOf的构造方法很多,你自己看看文档吧!
      

  2.   

    sorry. 错了。
    int i = s.indexOf("BB"))
      

  3.   

    if(s.indexOf("BB")!=-1){
      //存在
    }
      

  4.   

    在java中你可以使用String类中的indexof()方法搜索你要查的字符出现的位置,返回给你的是字符串的第一个字符在你查找的字符串里的位置,你还可以用lastindexof()方法,用法同上。
    比如:
    int at=0;
    String s="abcdef";
    String fandstr="cd";//要查找的字符串
    at=s.indexof(fandstr);//位置
      

  5.   

    indexOf()
    应该是它。^_^