super-split

2019-06-16 admin

super-split是什么

什么是super-split,🔪 split string by delimiter array - delimiters retained

super-split使用教程帮助文档

Super-Split

<g-emoji class=“g-emoji” alias=“hocho” fallback-src=“https://github.githubassets.com/images/icons/emoji/unicode/1f52a.png”>🔪</g-emoji> 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']

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-67450.html

文章标题:super-split

回到顶部