操作字符串有这样一个方法吗, split(),请问这个方法是什么意思?该怎样使用?

解决方案 »

  1.   

    split的其中之一方法
    public String[] split(String regex)
    Splits this string around matches of the given regular expression. 
    根据与所提供的正则表达式模式相匹配的字符串来分割字符串例子如下
    The string "boo:and:foo", for example, yields the following results with these expressions: Regex Result 
    : { "boo", "and", "foo" } 
    o { "b", "", ":and:f" } 
      

  2.   

    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
      

  3.   

    是用来拆分字符串的,你可以找Java的技术文章看看,是怎么用的。
      

  4.   

    英语不好的话下个中文API 新翻译的不错,我正在用..英语实在太差..呵呵
      

  5.   

    看看这个程序,你就晓得咋用了
    String nihao = "nihao,china,I love you";
    String[] hello = nihao.split(",");
    for (int i = 0; i < hello.length; i++) {
        System.out.println(hello[i]);
    }
      

  6.   

    百度搜个好点的JAVA API下载
      

  7.   

    结果:
    nihao
    china
    I love you
      

  8.   

    由不同的两个,分为带参数的何不带参数的:
    public String[] split(String regex,int limit)
    根据匹配给定的正则表达式来拆分此字符串。 
    此方法返回的数组包含此字符串的每个子字符串,这些子字符串由另一个匹配给定的表达式的子字符串终止或由字符串结束来终止。数组中的子字符串按它们在此字符串中的顺序排列。如果表达式不匹配输入的任何部分,则结果数组只具有一个元素,即此字符串。 limit 参数控制模式应用的次数,因此影响结果数组的长度。如果该限制 n 大于 0,则模式将被最多应用 n - 1 次,数组的长度将不会大于 n,而且数组的最后项将包含超出最后匹配的定界符的所有输入。如果 n 为非正,则模式将被应用尽可能多的次数,而且数组可以是任意长度。如果 n 为零,则模式将被应用尽可能多的次数,数组可有任何长度,并且结尾空字符串将被丢弃。
    public String[] split(String regex)
    根据给定的正则表达式的匹配来拆分此字符串。 
    该方法的作用就像是使用给定的表达式和限制参数 0 来调用两参数 split 方法。因此,结果数组中不包括结尾空字符串。
    可以差异下JDK API ,由中文版的
      

  9.   

    下一个jdk中文帮助文档看看,就明白了。
    在csdn的下载里就有
      

  10.   

    又是一个不知道如何学习的!API始终是你最好的帮手!
      

  11.   

    看看这个就明白了:
    public class TEST {
           public static void main(String[] args) {
    // TODO Auto-generated method stub
            String str = "i am not a girl";
    String []str2 = str.split("not");
    for (int i = 0; i < str2.length; i++) {
        System.out.print(str2[i]);
    }
    }
    }
      

  12.   

    广告真多,就是java是金饭碗,那“公仆”就不知道是什么碗了。