uni-string
v2.0.7
Published
Unicode String object
Downloads
14,883
Maintainers
Readme
uni-string
Unicode-aware String object
npm install uni-string
api
- see API
- MDN String
demo
import UString from 'packages/uni-string/src/index';
const UString = require('packages/uni-string/src/index')
console.log(UString.support);
let t = (new UString('♥️𠬠典')).padStart(10, '𠬠');
t = t.concat('\n♥️𠬠典そこで彼らは\'",オリーブ山と呼ばれる山からエルサレムに帰った。');
console.dir(t);
let t2 = new UString(t);
console.log(t2);
//console.log(666, t2.substr(-9, 3));
console.log(666, t2.indexOf('𠬠典', 2));
console.log(666, t2.endsWith('𠬠典'));
let t3 = new UString('👩👩👧👦');
console.log(t3.size(), t3.split(''));
console.log('length', t2.length);
console.log('charLength', t2.charLength);
console.log('size()', t2.size());
//length 70
//charLength 49
//size() 49
UString.support
{
split: true,
substr: true,
substring: true,
indexOf: true,
includes: true,
slice: true,
charAt: true,
startsWith: true,
endsWith: true,
padEnd: true,
padStart: true }