Skip to content

Instantly share code, notes, and snippets.

@st98
Last active December 28, 2015 08:19
Show Gist options
  • Save st98/7470629 to your computer and use it in GitHub Desktop.
Save st98/7470629 to your computer and use it in GitHub Desktop.
文字列をn文字ずつ分割する関数。
String::partition = (n) -> @match new RegExp('(.{' + n + '})|(.+)', 'g')
String.prototype.partition = function (n) {
return this.match(new RegExp('(.{' + n + '})|(.+)', 'g'));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment