splitEvery

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.string

Split a string every n chars either by taking care of not spliting the words, or by simply spliting without any attention to that…

Params

  1. text*-String

    The text to split

  2. every*-Number

    How many characters to split the text

  3. settings{}Partial<TSplitEverySettings

    Some settings to configure your split process

Return

  1. -Array

    An array of the splited text parts

Example

import { splitEvery } from '@blackbyte/sugar/string';
splitEvery('Hello World', 2, {
   splitWords: true
}); // => ['He','ll','o ','Wo','rl','d']

Settings

  1. splitWordstrueBoolean

    If you want to split the words or not…

Todo

  • testsnormal