question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect length for some emojis

See original GitHub issue

Hi there, the library returns incorrect length:

len("❤️"); // 2
len("👊🏽"); // 2

I don’t seem to be able to find a solution for this in ANY library except lodash which has a complicated regex…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sallarcommented, Jul 31, 2016

I fixed this problem in my own library using a regex borrowed from lodash… https://github.com/sallar/stringz

0reactions
reveltcommented, Jan 31, 2020

I understand, yet terminology conundrum is still here, it’s not string length, it’s code point count

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong length of emoji #2552 - facebook/draft-js - GitHub
Wrong length for some of emojis​​ So, the length of emojis are: 😀 - has length 1. 🏖️ - has length 2. ❤️...
Read more >
Only 2 emoji return an incorrect length when compared ...
With only 2 face emojis - the "smiling face" emoji and "frowning face" emoji, the range comes back as a length of 1....
Read more >
It's not wrong that "🤦🏼‍♂️".length == 7 - Henri Sivonen
length of a string containing an emoji results in a number greater than 1 (typically 2) and then proceeds to the conclusion that...
Read more >
Emoji Line Height Incorrect - Scriptable - Automators Talk
The problem is that for some reason the line height of the emoji is not quite the same as the rest of the...
Read more >
20 Emojis You've Been Using Wrong | SELF
Time to get schooled on practicing grammatically correct emoji usage with the help of Unicode's* very* extensive dictionary.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found