strDate.subString(0,8);
strDate.subString(1,8);
具体自己试一下。

解决方案 »

  1.   

    public String substring(int beginIndex,
                            int endIndex)
    Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.Examples:
     "hamburger".substring(4, 8) returns "urge"
     "smiles".substring(1, 5) returns "mile"
     
    Parameters:beginIndex - the beginning index, inclusive.
    endIndex - the ending index, exclusive.Returns:the specified substring.Throws:IndexOutOfBoundsException - if the beginIndex is negative, or endIndex is larger than the length of this String object, or beginIndex is larger than endIndex.
      

  2.   

    String str="YYYYMMDDYYYYMMDD";
    System.out.println(str.subString(0,8));
    System.out.println(str.subString(8));
      

  3.   

    way 1:
    String str="YYYYMMDDYYYYMMDD";
    System.out.println(str.trim().subString(a,b));a开始的字符的位置,B结束的位置
    way 2:
    自己写一方法
     public String SubString(String Str,int start,int end)
      {
       String Str1;
       int Len=Str.length();
       if((end-start)>Len)
        {
           return "";
        }
        for(int i=0;i<;i++)
        {
          Str1+=Sql.charAt(i)
        }
       return Str1
      }
      

  4.   

    来晚了, macoff(天堂) 说对了
      

  5.   

    调用subString()方法够用了,最好用size()判断一下。
      

  6.   

    仔细看看 xmvigour(微电--有狼的气质 没狼的勇气 真郁闷) ( ) 
    的回答,解决你的一系列问题。这种问题还是多试着从文档里边找找吧。
      

  7.   

    Please consult sun's jdk.