升级jdk1.4 呵呵
或者也许把jdk的api考到jdk1.3里

解决方案 »

  1.   

    不过,你可以自己使用replace进行实现的。结合indexOf进行实现了。
      

  2.   

    如果是想过滤字符,那么用js就可以达到这个效果。function replaceChars(entry) 
    {
    out = new Array("源字符串");
    add = new Array("目标字符串");temp = "" + entry; // temporary holder
          for (i=0;i<字符串长度;i++)
          {
                while (temp.indexOf(out[i])>-1) 
                {
                       pos= temp.indexOf(out[i]);
                       temp = "" + (temp.substring(0, pos) + add[i] + temp.substring((pos + out[i].length), temp.length));
                 }
          }
    document.form.Body.value = temp;
    }
      

  3.   

    public String Replace(String str1,String str2,String str3,boolean blnIgnoreCase)
    {
    int intStart=0,intFind=0;
    int intEnd=0; String strTemp1=str1;
    String strTemp2=str2;
    if (blnIgnoreCase)
    {
    strTemp1=strTemp1.toLowerCase();
    strTemp2=strTemp2.toLowerCase();
    } StringBuffer bufResult=new StringBuffer(strTemp1.length());
    intFind= strTemp1.indexOf(strTemp2, intStart);
    while(intFind>=0)
    {
    if (intFind>intStart)
    {
    bufResult.append(str1.substring(intStart,intFind));
    }
    bufResult.append(str3);
    intStart = intFind+strTemp2.length();
    intFind= strTemp1.indexOf(strTemp2, intStart);
    } if (intStart<str1.length()) bufResult.append(strTemp1.substring(intStart));
    return bufResult.toString() ;
    }
      

  4.   

    public String Replace(String str1,String str2,String str3,boolean blnIgnoreCase)
    {
    int intStart=0,intFind=0;
    int intEnd=0; String strTemp1=str1;
    String strTemp2=str2;
    if (blnIgnoreCase)
    {
    strTemp1=strTemp1.toLowerCase();
    strTemp2=strTemp2.toLowerCase();
    } StringBuffer bufResult=new StringBuffer(strTemp1.length());
    intFind= strTemp1.indexOf(strTemp2, intStart);
    while(intFind>=0)
    {
    if (intFind>intStart)
    {
    bufResult.append(str1.substring(intStart,intFind));
    }
    bufResult.append(str3);
    intStart = intFind+strTemp2.length();
    intFind= strTemp1.indexOf(strTemp2, intStart);
    }
    if (intStart<str1.length()) bufResult.append(strTemp1.substring(intStart));
    return bufResult.toString() ;
    }