one^|uno||three^^^^|four^^^|^cuatro|and using
|
as a separator and ^
as escape character, your function should output the following array:
['one|uno', '', 'three^^', 'four^|cuatro', '']
tokenize
should be a function.
testString: assert(typeof tokenize === 'function');
- text: tokenize
should return an array.
testString: assert(typeof tokenize('a', 'b', 'c') === 'object');
- text: tokenize('one^|uno||three^^^^|four^^^|^cuatro|', '|', '^')
should return ['one|uno', '', 'three^^', 'four^|cuatro', '']
testString: assert.deepEqual(tokenize(testStr1, '|', '^'), res1);
- text: tokenize('a@&bcd&ef&&@@hi', '&', '@')
should return ['a&bcd', 'ef', '', '@hi']
testString: assert.deepEqual(tokenize(testStr2, '&', '@'), res2);
```