{"action":"created","comment":{"url":"https://api.github.com/repos/asciidwango/js-primer/pulls/comments/101906634","pull_request_review_id":22650079,"id":101906634,"diff_hunk":"@@ -80,6 +80,40 @@ console.log(`Hello ${name}!`);// => \"Hello JavaScript!\"\n - [ ] 文字\n \n ## 文字列の分解と結合 {#split-join}\n+\n+文字列を配列へ分解するには`String#split`メソッドを利用できます。\n+一方、配列の要素を結合し文字列には`Array#join`メソッドが利用できます。\n+\n+この２つはよく組み合わせて利用されるためあわせてみていきます。\n+\n+`String#split`メソッドは、第一引数に指定した区切り文字で文字列を分解した配列を返します。\n+次のコードでは、文字列を`、`で区切った配列を作成しています。\n+\n+```js\n+var strings = \"赤、青、緑\".split(\"、\");\n+console.log(strings); // => [\"赤\", \"青\", \"緑\"]\n+```\n+\n+分解してできた文字列の配列を結合して文字列を作る際に、`Array#join`メソッドがよく利用されます。\n+`Array#join`メソッドの第一引数には区切り文字を指定し、その区切り文字で結合した文字列を返します。\n+\n+この２つを合わせれば、区切り文字を`、`から`,`へ変換する処理を次のように書くことができます。\n+\n+```js\n+var string = \"赤、青、緑\".split(\"、\").join(\",\");","path":"source/basic/string/README.md","position":21,"original_position":24,"commit_id":"767fcfde4765f664aba9a56390690125b17334ad","original_commit_id":"767fcfde4765f664aba9a56390690125b17334ad","user":{"login":"azu","id":19714,"avatar_url":"https://avatars.githubusercontent.com/u/19714?v=3","gravatar_id":"","url":"https://api.github.com/users/azu","html_url":"https://github.com/azu","followers_url":"https://api.github.com/users/azu/followers","following_url":"https://api.github.com/users/azu/following{/other_user}","gists_url":"https://api.github.com/users/azu/gists{/gist_id}","starred_url":"https://api.github.com/users/azu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azu/subscriptions","organizations_url":"https://api.github.com/users/azu/orgs","repos_url":"https://api.github.com/users/azu/repos","events_url":"https://api.github.com/users/azu/events{/privacy}","received_events_url":"https://api.github.com/users/azu/received_events","type":"User","site_admin":false},"body":"`・` たしかに良さそうですね。\r\nありがとうございます","created_at":"2017-02-19T01:28:40Z","updated_at":"2017-02-19T01:28:40Z","html_url":"https://github.com/asciidwango/js-primer/pull/187#discussion_r101906634","pull_request_url":"https://api.github.com/repos/asciidwango/js-primer/pulls/187","_links":{"self":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/comments/101906634"},"html":{"href":"https://github.com/asciidwango/js-primer/pull/187#discussion_r101906634"},"pull_request":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/187"}}},"pull_request":{"url":"https://api.github.com/repos/asciidwango/js-primer/pulls/187","id":106863296,"html_url":"https://github.com/asciidwango/js-primer/pull/187","diff_url":"https://github.com/asciidwango/js-primer/pull/187.diff","patch_url":"https://github.com/asciidwango/js-primer/pull/187.patch","issue_url":"https://api.github.com/repos/asciidwango/js-primer/issues/187","number":187,"state":"open","locked":false,"title":"[WIP] feat(string): 文字列の分解と結合","user":{"login":"azu","id":19714,"avatar_url":"https://avatars.githubusercontent.com/u/19714?v=3","gravatar_id":"","url":"https://api.github.com/users/azu","html_url":"https://github.com/azu","followers_url":"https://api.github.com/users/azu/followers","following_url":"https://api.github.com/users/azu/following{/other_user}","gists_url":"https://api.github.com/users/azu/gists{/gist_id}","starred_url":"https://api.github.com/users/azu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azu/subscriptions","organizations_url":"https://api.github.com/users/azu/orgs","repos_url":"https://api.github.com/users/azu/repos","events_url":"https://api.github.com/users/azu/events{/privacy}","received_events_url":"https://api.github.com/users/azu/received_events","type":"User","site_admin":false},"body":"#121 \r\n\r\n- `String#split`\r\n- `Array#join`\r\n- 正規表現で区切る\r\n- 空文字を引数に取った場合はcode unitで区切る\r\n- 文字で区切りたい場合はIteratorかspreadする","created_at":"2017-02-18T14:28:44Z","updated_at":"2017-02-19T01:28:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0313b4917930d714b29a4c9a76842e604eb5dc3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/asciidwango/js-primer/pulls/187/commits","review_comments_url":"https://api.github.com/repos/asciidwango/js-primer/pulls/187/comments","review_comment_url":"https://api.github.com/repos/asciidwango/js-primer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/asciidwango/js-primer/issues/187/comments","statuses_url":"https://api.github.com/repos/asciidwango/js-primer/statuses/767fcfde4765f664aba9a56390690125b17334ad","head":{"label":"asciidwango:string-split-join","ref":"string-split-join","sha":"767fcfde4765f664aba9a56390690125b17334ad","user":{"login":"asciidwango","id":10266070,"avatar_url":"https://avatars.githubusercontent.com/u/10266070?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidwango","html_url":"https://github.com/asciidwango","followers_url":"https://api.github.com/users/asciidwango/followers","following_url":"https://api.github.com/users/asciidwango/following{/other_user}","gists_url":"https://api.github.com/users/asciidwango/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidwango/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidwango/subscriptions","organizations_url":"https://api.github.com/users/asciidwango/orgs","repos_url":"https://api.github.com/users/asciidwango/repos","events_url":"https://api.github.com/users/asciidwango/events{/privacy}","received_events_url":"https://api.github.com/users/asciidwango/received_events","type":"Organization","site_admin":false},"repo":{"id":50896111,"name":"js-primer","full_name":"asciidwango/js-primer","owner":{"login":"asciidwango","id":10266070,"avatar_url":"https://avatars.githubusercontent.com/u/10266070?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidwango","html_url":"https://github.com/asciidwango","followers_url":"https://api.github.com/users/asciidwango/followers","following_url":"https://api.github.com/users/asciidwango/following{/other_user}","gists_url":"https://api.github.com/users/asciidwango/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidwango/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidwango/subscriptions","organizations_url":"https://api.github.com/users/asciidwango/orgs","repos_url":"https://api.github.com/users/asciidwango/repos","events_url":"https://api.github.com/users/asciidwango/events{/privacy}","received_events_url":"https://api.github.com/users/asciidwango/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/asciidwango/js-primer","description":"JavaScriptの入門書 :book: ","fork":false,"url":"https://api.github.com/repos/asciidwango/js-primer","forks_url":"https://api.github.com/repos/asciidwango/js-primer/forks","keys_url":"https://api.github.com/repos/asciidwango/js-primer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asciidwango/js-primer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asciidwango/js-primer/teams","hooks_url":"https://api.github.com/repos/asciidwango/js-primer/hooks","issue_events_url":"https://api.github.com/repos/asciidwango/js-primer/issues/events{/number}","events_url":"https://api.github.com/repos/asciidwango/js-primer/events","assignees_url":"https://api.github.com/repos/asciidwango/js-primer/assignees{/user}","branches_url":"https://api.github.com/repos/asciidwango/js-primer/branches{/branch}","tags_url":"https://api.github.com/repos/asciidwango/js-primer/tags","blobs_url":"https://api.github.com/repos/asciidwango/js-primer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asciidwango/js-primer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asciidwango/js-primer/git/refs{/sha}","trees_url":"https://api.github.com/repos/asciidwango/js-primer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asciidwango/js-primer/statuses/{sha}","languages_url":"https://api.github.com/repos/asciidwango/js-primer/languages","stargazers_url":"https://api.github.com/repos/asciidwango/js-primer/stargazers","contributors_url":"https://api.github.com/repos/asciidwango/js-primer/contributors","subscribers_url":"https://api.github.com/repos/asciidwango/js-primer/subscribers","subscription_url":"https://api.github.com/repos/asciidwango/js-primer/subscription","commits_url":"https://api.github.com/repos/asciidwango/js-primer/commits{/sha}","git_commits_url":"https://api.github.com/repos/asciidwango/js-primer/git/commits{/sha}","comments_url":"https://api.github.com/repos/asciidwango/js-primer/comments{/number}","issue_comment_url":"https://api.github.com/repos/asciidwango/js-primer/issues/comments{/number}","contents_url":"https://api.github.com/repos/asciidwango/js-primer/contents/{+path}","compare_url":"https://api.github.com/repos/asciidwango/js-primer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asciidwango/js-primer/merges","archive_url":"https://api.github.com/repos/asciidwango/js-primer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asciidwango/js-primer/downloads","issues_url":"https://api.github.com/repos/asciidwango/js-primer/issues{/number}","pulls_url":"https://api.github.com/repos/asciidwango/js-primer/pulls{/number}","milestones_url":"https://api.github.com/repos/asciidwango/js-primer/milestones{/number}","notifications_url":"https://api.github.com/repos/asciidwango/js-primer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asciidwango/js-primer/labels{/name}","releases_url":"https://api.github.com/repos/asciidwango/js-primer/releases{/id}","deployments_url":"https://api.github.com/repos/asciidwango/js-primer/deployments","created_at":"2016-02-02T05:16:25Z","updated_at":"2017-02-16T03:42:11Z","pushed_at":"2017-02-18T14:28:44Z","git_url":"git://github.com/asciidwango/js-primer.git","ssh_url":"git@github.com:asciidwango/js-primer.git","clone_url":"https://github.com/asciidwango/js-primer.git","svn_url":"https://github.com/asciidwango/js-primer","homepage":"https://asciidwango.github.io/js-primer/","size":3974,"stargazers_count":474,"watchers_count":474,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":45,"forks":14,"open_issues":45,"watchers":474,"default_branch":"master"}},"base":{"label":"asciidwango:master","ref":"master","sha":"0bdd0a14f4fc590fc74904947ddcb8a2319b5d00","user":{"login":"asciidwango","id":10266070,"avatar_url":"https://avatars.githubusercontent.com/u/10266070?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidwango","html_url":"https://github.com/asciidwango","followers_url":"https://api.github.com/users/asciidwango/followers","following_url":"https://api.github.com/users/asciidwango/following{/other_user}","gists_url":"https://api.github.com/users/asciidwango/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidwango/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidwango/subscriptions","organizations_url":"https://api.github.com/users/asciidwango/orgs","repos_url":"https://api.github.com/users/asciidwango/repos","events_url":"https://api.github.com/users/asciidwango/events{/privacy}","received_events_url":"https://api.github.com/users/asciidwango/received_events","type":"Organization","site_admin":false},"repo":{"id":50896111,"name":"js-primer","full_name":"asciidwango/js-primer","owner":{"login":"asciidwango","id":10266070,"avatar_url":"https://avatars.githubusercontent.com/u/10266070?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidwango","html_url":"https://github.com/asciidwango","followers_url":"https://api.github.com/users/asciidwango/followers","following_url":"https://api.github.com/users/asciidwango/following{/other_user}","gists_url":"https://api.github.com/users/asciidwango/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidwango/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidwango/subscriptions","organizations_url":"https://api.github.com/users/asciidwango/orgs","repos_url":"https://api.github.com/users/asciidwango/repos","events_url":"https://api.github.com/users/asciidwango/events{/privacy}","received_events_url":"https://api.github.com/users/asciidwango/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/asciidwango/js-primer","description":"JavaScriptの入門書 :book: ","fork":false,"url":"https://api.github.com/repos/asciidwango/js-primer","forks_url":"https://api.github.com/repos/asciidwango/js-primer/forks","keys_url":"https://api.github.com/repos/asciidwango/js-primer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asciidwango/js-primer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asciidwango/js-primer/teams","hooks_url":"https://api.github.com/repos/asciidwango/js-primer/hooks","issue_events_url":"https://api.github.com/repos/asciidwango/js-primer/issues/events{/number}","events_url":"https://api.github.com/repos/asciidwango/js-primer/events","assignees_url":"https://api.github.com/repos/asciidwango/js-primer/assignees{/user}","branches_url":"https://api.github.com/repos/asciidwango/js-primer/branches{/branch}","tags_url":"https://api.github.com/repos/asciidwango/js-primer/tags","blobs_url":"https://api.github.com/repos/asciidwango/js-primer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asciidwango/js-primer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asciidwango/js-primer/git/refs{/sha}","trees_url":"https://api.github.com/repos/asciidwango/js-primer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asciidwango/js-primer/statuses/{sha}","languages_url":"https://api.github.com/repos/asciidwango/js-primer/languages","stargazers_url":"https://api.github.com/repos/asciidwango/js-primer/stargazers","contributors_url":"https://api.github.com/repos/asciidwango/js-primer/contributors","subscribers_url":"https://api.github.com/repos/asciidwango/js-primer/subscribers","subscription_url":"https://api.github.com/repos/asciidwango/js-primer/subscription","commits_url":"https://api.github.com/repos/asciidwango/js-primer/commits{/sha}","git_commits_url":"https://api.github.com/repos/asciidwango/js-primer/git/commits{/sha}","comments_url":"https://api.github.com/repos/asciidwango/js-primer/comments{/number}","issue_comment_url":"https://api.github.com/repos/asciidwango/js-primer/issues/comments{/number}","contents_url":"https://api.github.com/repos/asciidwango/js-primer/contents/{+path}","compare_url":"https://api.github.com/repos/asciidwango/js-primer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asciidwango/js-primer/merges","archive_url":"https://api.github.com/repos/asciidwango/js-primer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asciidwango/js-primer/downloads","issues_url":"https://api.github.com/repos/asciidwango/js-primer/issues{/number}","pulls_url":"https://api.github.com/repos/asciidwango/js-primer/pulls{/number}","milestones_url":"https://api.github.com/repos/asciidwango/js-primer/milestones{/number}","notifications_url":"https://api.github.com/repos/asciidwango/js-primer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asciidwango/js-primer/labels{/name}","releases_url":"https://api.github.com/repos/asciidwango/js-primer/releases{/id}","deployments_url":"https://api.github.com/repos/asciidwango/js-primer/deployments","created_at":"2016-02-02T05:16:25Z","updated_at":"2017-02-16T03:42:11Z","pushed_at":"2017-02-18T14:28:44Z","git_url":"git://github.com/asciidwango/js-primer.git","ssh_url":"git@github.com:asciidwango/js-primer.git","clone_url":"https://github.com/asciidwango/js-primer.git","svn_url":"https://github.com/asciidwango/js-primer","homepage":"https://asciidwango.github.io/js-primer/","size":3974,"stargazers_count":474,"watchers_count":474,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":45,"forks":14,"open_issues":45,"watchers":474,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/187"},"html":{"href":"https://github.com/asciidwango/js-primer/pull/187"},"issue":{"href":"https://api.github.com/repos/asciidwango/js-primer/issues/187"},"comments":{"href":"https://api.github.com/repos/asciidwango/js-primer/issues/187/comments"},"review_comments":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/187/comments"},"review_comment":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/asciidwango/js-primer/pulls/187/commits"},"statuses":{"href":"https://api.github.com/repos/asciidwango/js-primer/statuses/767fcfde4765f664aba9a56390690125b17334ad"}}}}
{"actor":{"display_login":"azu"}}