<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    kooyee ‘s blog

    開源軟件, 眾人努力的結晶, 全人類的共同財富
    posts - 103, comments - 55, trackbacks - 0, articles - 66
       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    [Java.lang]String.split用法

    Posted on 2007-07-17 23:29 kooyee 閱讀(1548) 評論(0)  編輯  收藏 所屬分類: Java

    public String[] split(String regex, int limit)

    limit n 大于0,則pattern(模式)應用n - 1 次

    String s = "boo:and:foo"
    s.split(
    ":",2)
    //result is { "boo", "and:foo" }

    limit n 小于0,則pattern(模式)應用無限次

    String s = "boo:and:foo"
    s.split(
    ":",-2)
    //result is { "boo", "and", "foo" }

    limit n 等于0,則pattern(模式)應用無限次并且省略末尾的空字串

    String s = "boo:and:foo"
    s.split("o", -2)
       //result is { "b", "", "and:f", "", "" }
       s.split(
    "o", 0)
       //result is { "b", "", "and:f" }




    The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded.

    The string "boo:and:foo", for example, yields the following results with these parameters:

    Regex Limit Result
    : 2 { "boo", "and:foo" }
    : 5 { "boo", "and", "foo" }
    : -2 { "boo", "and", "foo" }
    o 5 { "b", "", ":and:f", "", "" }
    o -2 { "b", "", ":and:f", "", "" }
    o 0 { "b", "", ":and:f" }

    主站蜘蛛池模板: 免费看a级黄色片| 日本牲交大片免费观看| 亚洲小说区图片区另类春色| 日韩在线观看免费| 免费吃奶摸下激烈视频| 特级毛片A级毛片免费播放| 吃奶摸下高潮60分钟免费视频| 风间由美在线亚洲一区| www国产亚洲精品久久久| 男女交性无遮挡免费视频| 亚洲欧洲精品成人久久曰影片| 黄视频在线观看免费| 亚洲精品高清无码视频| 久久久久免费看黄a级试看| 亚洲欧洲另类春色校园小说| 成人免费看片又大又黄| 国产精品自拍亚洲| 亚洲愉拍99热成人精品热久久| 国产成人免费ā片在线观看老同学| 亚洲AV无码成人精品区蜜桃| 亚洲黄色免费观看| 亚洲av无码一区二区三区人妖| 又黄又爽一线毛片免费观看| 一级有奶水毛片免费看| 亚洲美女人黄网成人女| 性做久久久久免费观看| 精品97国产免费人成视频| 亚洲色成人网一二三区| 精品久久久久久久免费人妻| jizz免费在线影视观看网站| 亚洲人成在线观看| 四虎影院在线免费播放| 韩国免费a级作爱片无码| 亚洲狠狠狠一区二区三区| 国产乱色精品成人免费视频 | 国产亚洲精品VA片在线播放| 国产乱子伦精品免费无码专区| 在线观看免费黄网站| 亚洲日日做天天做日日谢| 亚洲性日韩精品一区二区三区| 中文免费观看视频网站|