Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including unicode-string-utils with all npm packages installed. Try it out:

var unicodeStringUtils = require("unicode-string-utils")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

unicode-string-utils v0.1.0

Fixes for JavaScript's Unicode problem



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


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


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 💥


npm install -g mocha
mocha tests

Please note

As mentioned in the above blog post, with ES6 you probably won't need these utils.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free