Skip to content

🔪 split string by delimiter array - delimiters retained

License

Notifications You must be signed in to change notification settings

sleyter93/super-split

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Super-Split

🔪 split string by delimiter array - delimiters retained

Build Status Coverage Status NPM Version XO code style

Install

$ yarn add super-split

Usage

Split a string

const superSplit = require('super-split')

const str = 'A+B-C'
const delimiters = ['+', '-']
const result = superSplit(str, delimiters)

Result:

['A', '+', 'B', '-', 'C']

Split with ANSI

const str = 'I like to \u001b[34mmove it\u001b[39m, move it.'

const delimiters = ['\u001b[34m', '\u001b[39m']

const result = superSplit(str, delimiters)

Result:

['I like to ', '\u001b[34m', 'move it', '\u001b[39m', ', move it.']

Split Array

const ary = [':-)', 'o_O']

const delimiters = ['-', '_']

const result = superSplit(ary, delimiters)

Result:

[':', '-', ')', 'o', '_', 'O']

About

🔪 split string by delimiter array - delimiters retained

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%