Created
May 8, 2018 06:49
-
-
Save shadeglare/1872982870c6046865b530846e8f7407 to your computer and use it in GitHub Desktop.
Split a string into chunks with the specified size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function splitString (value: string, chunkSize: number) { | |
let re = new RegExp('.{1,' + chunkSize + '}', 'g'); | |
return value.match(re); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment