split
public String[] split(String regex)
Splits this string around matches of the given regular expression. 
This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array. The string "boo:and:foo", for example, yields the following results with these expressions: Regex     Result 
: { "boo", "and", "foo" } 
o { "b", "", ":and:f" } 
Parameters:
regex - the delimiting regular expression 
Returns:
the array of strings computed by splitting this string around matches of the given regular expression 
Throws: 
PatternSyntaxException - if the regular expression's syntax is invalid 
NullPointerException - if regex is null
Since: 
1.4 
See Also:
Pattern=================一代过去,一代又来,地却永远长存。日头出来,日头落下,急归所出之地。
风往南刮,又往北转,不住的旋落,而且返回转行原道,江河都往海里转,海
却不满,江河从何处流,仍归何处。

解决方案 »

  1.   

    jdk1.4里的String类新增加了这个方法,具体用法和vb差不多
      

  2.   

    jdk1.4中可以直接使用split,以前版本可以使用StringTokenizer实现类似的功能,只是处理麻烦了点
      

  3.   

    jdk1。4有这个方法,不过自己写也不难啊,我记得我上次回答这个问题时候,写过一次
      

  4.   

    public static void main(String[] args) {
        String myStr = "a,b,c,d";
        String[] myStrs;
        myStrs = myStr.split(",");
        for (int i = 0; i < myStrs.length; i++){
          System.out.println(myStrs[i]);
        }
      }
      

  5.   

    大家都说了:)sdk1.4新带功能!
      

  6.   

    //import java.lang.String;
    import java.util.StringTokenizerString str;
    str.split
      

  7.   

    sdk1.4新带功能!
    如果不明白可以看看api帮助。
    或者在论坛上搜索一下,以前说过很多这方面的东西。