Oracle神諭

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            284 隨筆 :: 9 文章 :: 106 評論 :: 0 Trackbacks

            以前的做分隔符獲取一個個字符串很是麻煩,其實JDK中的String 類已經很好的解決了這個問題。正則表達式確實是個好東西!

          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世界暢談 閱讀(1792) 評論(1)  編輯  收藏 所屬分類: JAVA

          評論

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

          主站蜘蛛池模板: 成安县| 汝州市| 博野县| 宁安市| 桃园县| 弥勒县| 阳原县| 沙坪坝区| 中牟县| 勃利县| 江西省| 上杭县| 合山市| 汕尾市| 中牟县| 呼伦贝尔市| 高要市| 绩溪县| 高阳县| 梁河县| 九龙坡区| 内黄县| 三门县| 左云县| 六枝特区| 兴山县| 调兵山市| 丁青县| 无为县| 称多县| 镇平县| 库车县| 义乌市| 丽江市| 昌黎县| 福建省| 寿光市| 合山市| 澄江县| 稻城县| 台南县|