@tempots/std
chunkString() function
Returns an array of string
whose elements are equally long (using len
). If the string s
is not exactly divisible by len
the last element of the array will be shorter.
Signature:
chunkString: (s: string, len: number) => string[]
Parameters
Parameter |
Type |
Description |
---|---|---|
s |
string |
The string to chunk. |
len |
number |
The length of each chunk. |
Returns: string[]
An array of chunks.