Skip to content

amk221/unicode-string-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

unicode-string-utils [DEPRECATED]

Overview

JavaScript has a Unicode problem, see here for more information:

https://mathiasbynens.be/notes/javascript-unicode

Example
'πŸ’©'.length

...results in 2 when you would have been expecting 1.

Usage

unicodeStringUtils.length('πŸ’©'); // 1

unicodeStringUtils.symbols('Hello 🌍'); // ['H','e','l','l','o',' ','🌍']

unicodeStringUtils.slice('Boom πŸ’£ Pow πŸ’₯', -12, 6); // Boom πŸ’£

unicodeStringUtils.substring('Boom πŸ’£ Pow πŸ’₯', 7, 12); // Pow πŸ’₯

Tests

npm install -g mocha
mocha tests

Please note

About

πŸŒ€ Fixes for JavaScript's Unicode problem

Resources

Stars

Watchers

Forks

Packages

No packages published