the missing utilities of String
$ npm i power-string --save-dev
const PowerString = require('power-string');
const {
isChineseLetter,
getLength,
sliceString,
splitToArray
} = PowerString;
isChineseLetter('中'); // true
getLength('中'); // 2
sliceString('这是一句中文', 4); // 这是
splitToArray('这是一句中文+123456', 4); // [ '这是', '一句', '中文', '+123', '456' ]
xudafeng |
snapre |
---|
This project follows the git-contributor spec, auto updated at Mon May 23 2022 15:14:54 GMT+0000
.
The MIT License (MIT)