使用下面的方法public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
  }
  public int indexOf(String sourceStr,String str)
  {
    String str1=sourceStr.toLowerCase();
    String str2=str.toLowerCase();
    int i=str1.indexOf(str2);
    return i;
  }

解决方案 »

  1.   


    public int indexOf(String sourceStr,String str)
      {
        String str1=sourceStr.toLowerCase();
        String str2=str.toLowerCase();
        int i=str1.indexOf(str2);
        return i;
      } 
      

  2.   

    楼上各位能不能看懂我的意思呢?
    我说了,把字符串变成小写不行
    比如吧:
    String source 为 <FORM action="http://somehost.com/Login.sp">
    source.toLowerCase变成 <form action="http://somehost.com/login.jsp">
    这里我要找form和action
    source.indexOf("form")
    但是Login.jsp也变成了login.jsp
    那么这个action的内容也没用用了
    jsp区分大小写的各位同志
    当然还有变量和value等有些cgi也是区分大小写的
    不能顾了头忘了尾啊
      

  3.   

    我这个方法不是转变字符的,是用来查找字符串的,例如
    String str="<FORM action=\"http://somehost.com/Login.sp\">";
    int i=indexOf(str,"FORM");
    i就会返回1;但是str还是<FORM action="http://somehost.com/Login.sp">
    没有变,你仍然可以进行你的操作,满足你的要求呀
      

  4.   

    to gdsean(摇滚java) :
    用个中间变量来过渡!String source 为 <FORM action="http://somehost.com/Login.sp">
    String source1=source.oLowerCase();
    source1.indexOf("form")