简体   繁体   中英

How to convert special symbol to emoji character in JavaScript?

我需要将特殊字符转换为表情符号。

let text = "This time also delivered a big product in an awesome package and fast delivery, and one more thing, this product manufactured on May 19, onlyðððð totally 5¶¶¶¶¶ starts, to this product but front is made up of some type of steel but it is not up to me, remaining is really good";

If you are adding a emoji to a text, you can directly add it in the string:

https://www.kirupa.com/html5/emoji.htm

On the other hand, if the text is a input and you wish to pickup the emoji, you can use this package :

https://github.com/iamcal/js-emoji

ES6/ES2015 introduced a way to represent Unicode points in the astral planes (any Unicode code point requiring more than 4 chars), by wrapping the code in graph parentheses:

Format: \\u{XXXXX}

For Example:

\\u{1F436} will work and a dog emoji will appear

For reference you can check out this link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM