@aegenet/belt-string-split
v2.3.0
Published
String Split is an alternative to String.split, with the ability to ignore the split character inside 'tags'
Downloads
85
Readme
@aegenet/belt-string-split
String Split is an alternative to String.split, with the ability to ignore the split character inside 'tags'
💾 Installation
yarn add @aegenet/belt-string-split@^2.0.0
# or
npm i @aegenet/belt-string-split@^2.0.0
📝 Usage
import { StringSplit } from '@aegenet/belt-string-split';
const stringSplit = new StringSplit({
separator: ' ',
ignoreTags: {
'"': '"',
},
});
stringSplit.split('Hello Brian "Something Else"');
// ['Hello', 'Brian', '"Something Else"']
const stringSplit = new StringSplit({
separator: ' ',
ignoreTags: {
'(': ')',
},
});
stringSplit.split('Hello Brian (Something Else)');
// ['Hello', 'Brian', '(Something Else)']
stringSplit.split('Hello Brian (Something Else (or something))');
// ['Hello', 'Brian', '(Something Else (or something))']