How to count the correct length of a string with emojis in javascript?

I’ve a little problem. I’m using NodeJS as backend. Now, an user has a field “biography”, where the user can write something about himself. Suppose that this field has 220 maxlength, and suppose this as input: As you can see there aren’t 220 emojis (there are 37 emojis), but if I do in my nodejs server where bio is the input text, I got 221. How could I “parse” the string input to get the correct length? Is it a problem about unicode? SOLVED I used this library: https://github.com/orling/grapheme-splitter I tried that: and the length is 37. It works very

Remove last char string when string contains emojis

I’m using React Native (chat), in this app I have one emoji picker but when users press virtual backspace button emojis only remove their last unicode byte. How can I detect if last ‘chat’ (set of …

How can I remove the last emoji of a group of emojis in javascript?

Let’s say I have this 3 emojis in a string: 😀🎃👪 There are not any spaces or any other character except emojis in the string. How can I remove the last emoji in javascript?