Skip to content

chunlampang/words-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Words Splitter

Install

npm i words-splitter-multi-lang

Usage

let result = splitWords('Hello World. XD');
console.log(result); // [ 0, 6, 13 ]
console.log(result.length); // 3
console.log(cropText('Hello World. XD', 2, result)); // Hello World.

Cases

splitWords(' , , hi , ,');  // [ 5 ]
splitWords('中文-字XD'); // [ 0, 1, 3, 4 ]