Splits a string into length-size chunks.
length
If length is greater than the length of source, a single element array is returned with source. The final array element may be smaller if we ran out of characters.
source
splitByLength(`hello there`, 2);// Yields:// [`he`, `ll`, `o `, `th`, `er`, `e`] Copy
splitByLength(`hello there`, 2);// Yields:// [`he`, `ll`, `o `, `th`, `er`, `e`]
Source string
Length of each chunk
Splits a string into
length
-size chunks.If
length
is greater than the length ofsource
, a single element array is returned with source. The final array element may be smaller if we ran out of characters.