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

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

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

    kooyee ‘s blog

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

    [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(模式)應(yīng)用n - 1 次

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

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

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

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

    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" }

    主站蜘蛛池模板: 18禁超污无遮挡无码免费网站国产 | 免费看一级一级人妻片| 国产免费不卡视频| 亚洲妓女综合网99| 一个人免费高清在线观看| 亚洲免费人成视频观看| 国产精品成人免费一区二区 | 久久九九亚洲精品| 久久久精品国产亚洲成人满18免费网站 | 亚洲精品国产成人片| 两个人看的www免费| 亚洲av无码乱码国产精品fc2| 在线涩涩免费观看国产精品| 亚洲AV乱码久久精品蜜桃| 9420免费高清在线视频| 亚洲乱码无限2021芒果| 在线观看免费成人| 青青草97国产精品免费观看 | 黄页网站在线视频免费| 不卡精品国产_亚洲人成在线 | 黄色片网站在线免费观看| 亚洲人成人无码网www国产| 大地影院MV在线观看视频免费| 久久精品国产亚洲AV无码麻豆 | 久久亚洲精品成人AV| 少妇高潮太爽了在线观看免费| 亚洲欧美日韩国产精品一区| www.91亚洲| 国产精品免费看久久久| 久久精品国产亚洲AV忘忧草18| 国产成人3p视频免费观看| 99久久免费国产特黄| 亚洲国产成a人v在线| 亚洲国产成人精品女人久久久 | 中文字幕亚洲精品资源网| 成年女人视频网站免费m| av午夜福利一片免费看久久| 亚洲福利视频导航| 日韩免费a级在线观看| 日批视频网址免费观看| 亚洲一区精彩视频|