{"id":226,"date":"2014-07-23T12:45:24","date_gmt":"2014-07-23T03:45:24","guid":{"rendered":"http:\/\/kei0310.info\/?p=226"},"modified":"2014-07-23T12:52:02","modified_gmt":"2014-07-23T03:52:02","slug":"java-%e6%96%87%e5%ad%97%e5%88%97%e3%81%ae%e5%88%86%e5%89%b2%ef%bc%88split%ef%bc%89","status":"publish","type":"post","link":"http:\/\/kei0310.info\/?p=226","title":{"rendered":"[Java] \u6587\u5b57\u5217\u306e\u5206\u5272\uff08split\uff09"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u6587\u5b57\u5217\u306e\u5206\u5272\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<p>\u6614\u306fStringTokenizer\u30af\u30e9\u30b9\u306a\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u73fe\u5728\u306f\u975e\u63a8\u5968\u3068\u306a\u3063\u3066\u307e\u3059\u3002<br \/>\n\u304b\u308f\u308a\u306b\u3001String\u30af\u30e9\u30b9\u306b\u540c\u7b49\u306e\u6a5f\u80fd\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u25cfsplit\u306e\u57fa\u672c<br \/>\n\u9069\u5f53\u306a\u6587\u5b57\u5217\"aiueo_12345_67890\"\u3092\u3001\"_\"\u3067\u5206\u5272\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f8b\u984c\uff11\uff09\"aiueo_12345_67890\"\u3092\"_\"\u3067\u5206\u5272\u3059\u308b\u3002<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage test.string.split;\r\n\r\npublic class TestSplitString {\r\n\r\n\tpublic static void main(String[] args){\r\n\r\n\t\t\/\/ split\u5bfe\u8c61\u6587\u5b57\u5217\r\n\t\tString base = &quot;aiueo_12345_67890&quot;;\r\n\r\n\t\t\/\/ \u30bb\u30d1\u30ec\u30fc\u30bf\r\n\t\tString seperator = &quot;_&quot;;\r\n\r\n\t\t\/\/ split\u5b9f\u884c\r\n\t\tString[] ary = base.split(seperator);\r\n\r\n\t\t\/\/ \u7d50\u679c\u3092\u8868\u793a\r\n\t\tfor(String str : ary){\r\n\t\t\tSystem.out.println(str);\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<\/h6>\n<p>\u5b9f\u884c\u7d50\u679c\uff11\uff09<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naiueo\r\n12345\r\n67890\r\n<\/pre>\n<\/h6>\n<p>\u25cf\u5206\u5272\u56de\u6570\u306e\u6307\u5b9a<br \/>\nsplit\u306e\u7b2c\uff12\u5f15\u6570\u306b\u6570\u5024\u3092\u5165\u308c\u308b\u3053\u3068\u3067\u3001\u5206\u5272\u56de\u6570\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\u6570\u5024\u3092x\u3068\u3059\u308b\u3068\u3001x-1\u56de\u306e\u5206\u5272\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\n\u300cx\u500b\u306e\u8981\u7d20\u306b\u306a\u308b\u3088\u3046\u306b\u5206\u5272\u3059\u308b\u300d\u3068\u3044\u3046\u306e\u304c\u899a\u3048\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u984c\uff12\uff09\"aiueo_12345_67890\"\u3092\"_\"\u30671\u56de\u3060\u3051\u5206\u5272\u3059\u308b\u3002<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage test.string.split;\r\n\r\npublic class TestSplitString {\r\n\r\n\tpublic static void main(String[] args){\r\n\r\n\t\t\/\/ split\u5bfe\u8c61\u6587\u5b57\u5217\r\n\t\tString base = &quot;aiueo_12345_67890&quot;;\r\n\r\n\t\t\/\/ \u30bb\u30d1\u30ec\u30fc\u30bf\r\n\t\tString seperator = &quot;_&quot;;\r\n\r\n\t\t\/\/ split\u5b9f\u884c 1\u56de\u3060\u3051split\u3092\u5b9f\u884c\r\n\t\tString[] ary = base.split(seperator, 2);\r\n\r\n\t\t\/\/ \u7d50\u679c\u3092\u8868\u793a\r\n\t\tfor(String str : ary){\r\n\t\t\tSystem.out.println(str);\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<\/h6>\n<p>\u5b9f\u884c\u7d50\u679c\uff12\uff09<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\naiueo\r\n12345_67890\r\n<\/pre>\n<\/h6>\n<p>\u8a18\u4e8b\u66f8\u3044\u305f\u5f8c\u306b\u3001\u30af\u30e9\u30b9\u540d\u304cJUnit\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u3063\u307d\u304f\u306a\u3063\u3066\u308b\u3053\u3068\u306b\u6c17\u4ed8\u3044\u305f\u3051\u3069\u3001<br \/>\n\u9762\u5012\u306a\u306e\u3067\u6c17\u3065\u304b\u306a\u304b\u3063\u305f\u3053\u3068\u306b\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002 \u4eca\u56de\u306f\u3001\u6587\u5b57\u5217\u306e\u5206\u5272\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002 \u6614\u306fStringTokenizer\u30af\u30e9\u30b9\u306a\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u73fe\u5728\u306f\u975e\u63a8\u5968\u3068\u306a\u3063\u3066\u307e\u3059\u3002 \u304b\u308f\u308a\u306b\u3001String\u30af\u30e9\u30b9\u306b\u540c\u7b49\u306e\u6a5f\u80fd\u304c\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002 \u25cfsplit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,28],"tags":[183,74,75,46],"_links":{"self":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/226"}],"collection":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=226"}],"version-history":[{"count":5,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":231,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions\/231"}],"wp:attachment":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}