Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Multi Split

Split a string into an array of substrings using an array of strings as seperators.

Javascript's current String.split() only allows a single string to be specified as a seperator or Regex can be used which can become complicated and error prone if for example characters need to be prefixed with escape characters.

Multi Split allows you to split a sting on an array of strings. No Regex is required.

Example

constmultiSplit=require('multi-split');constresult=multiSplit("The quick brown fox jumps over the lazy dog",['quick','jumps']);console.log(result);// [ 'The ', ' brown fox ', ' over the lazy dog' ]

Example 2

constmultiSplit=require('multi-split');constresult=multiSplit("this.is a+string&with(lots$of@seperators",['+','.',' ','(','&','$','@']);console.log(result);//[ 'this', 'is', 'a', 'string', 'with', 'lots', 'of', 'seperators' ]

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages