Oracle神諭

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            284 隨筆 :: 9 文章 :: 106 評(píng)論 :: 0 Trackbacks

            以前的做分隔符獲取一個(gè)個(gè)字符串很是麻煩,其實(shí)JDK中的String 類已經(jīng)很好的解決了這個(gè)問題。正則表達(dá)式確實(shí)是個(gè)好東西!

          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
          Since:
          1.4
          See Also:
          Pattern
          posted on 2005-09-29 16:23 java世界暢談 閱讀(1789) 評(píng)論(1)  編輯  收藏 所屬分類: JAVA

          評(píng)論

          # re: String.class 的split方法 2006-01-07 17:41 山之上,國(guó)有殤
          呵呵 地球人都知道  回復(fù)  更多評(píng)論
            

          主站蜘蛛池模板: 辽宁省| 会泽县| 邛崃市| 洞头县| 全南县| 阿荣旗| 三原县| 翁牛特旗| 乌拉特后旗| 新宁县| 司法| 都安| 贵溪市| 凭祥市| 南川市| 扶风县| 南宁市| 甘德县| 康定县| 林州市| 成安县| 教育| 库车县| 晋宁县| 龙泉市| 镇原县| 衡山县| 德安县| 凉山| 茂名市| 新绛县| 竹山县| 运城市| 唐河县| 高阳县| 葫芦岛市| 中西区| 方正县| 宁德市| 和平县| 云龙县|