next-slice2str
Slice string to two part.
installation
npm install -S @jswork/next-slice2str
apis
argument | type | default |
---|---|---|
str | String | - |
index | Number | - |
step | Number | 0 |
usage
import '@jswork/next-slice2str';
const str = 'test@123.com';
const idx = str.indexOf('@');
const arr1 = nx.slice2str(str, idx);
const arr2 = nx.slice2str(str, idx, 1);
// [ 'test', '123.com' ]
// [ 'test', '123.com' ]
license
Code released under the MIT license.