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 山之上,國有殤
          呵呵 地球人都知道  回復  更多評論
            

          主站蜘蛛池模板: 宁陕县| 灵川县| 南京市| 大方县| 南部县| 金山区| 乳源| 龙江县| 长沙市| 榆中县| 阿拉善左旗| 绍兴市| 沅陵县| 滕州市| 洛宁县| 宁德市| 右玉县| 鄂温| 塔城市| 盐池县| 元阳县| 绵竹市| 揭西县| 枣阳市| 白山市| 阜康市| 南安市| 侯马市| 武定县| 容城县| 新宁县| 大城县| 青铜峡市| 珲春市| 谢通门县| 青浦区| 上饶市| 都江堰市| 闽侯县| 林芝县| 贺兰县|