split-on-last
v1.0.0
Published
Like split-on-first but splits on the last occurence.
Downloads
9
Maintainers
Readme
Split on last
Like split-on-first but splits on the last occurence.
Install
npm install split-on-last
Usage
const splitOnlast = require('split-on-last');
splitOnlast('a-b-c', '-');
//=> ['a-b', 'c']
splitOnlast('key:value:value2', ':');
//=> ['key:value', 'value2']
splitOnlast('a---b---c', '---');
//=> ['a---b', 'c']
splitOnlast('a-b-c', '+');
//=> []
splitOnlast('abc', '');
//=> []
API
splitOnLast(string, seperator)
string
Type: string
The string to split.
seperator
Type: string
The separator to split on.