简体   繁体   English

如何在 JavaScript 中将特殊符号转换为表情符号?

[英]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 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 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: ES6/ES2015 引入了一种在星体平面中表示 Unicode 点的方法(任何需要超过 4 个字符的 Unicode 代码点),通过将代码包装在图形括号中:

Format: \\u{XXXXX}格式: \\u{XXXXX}

For Example:例如:

\\u{1F436} will work and a dog emoji will appear \\u{1F436}会起作用,并且会出现一个狗表情符号

For reference you can check out this link .作为参考,您可以查看此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 unicode 点转换为表情符号 || 符号 || 特点 - How to convert unicode point to Emoji || Symbol || Character 如何使用 javascript 将每个特殊字符和表情符号转换为其 html 实体? - How can i convert every special character and emoji into its html entity using javascript? 删除字符和特殊符号并将字符串转换为JavaScript中的数组 - Remove character and special symbol and Convert String to array in javascript 如何将一个表情符号字符转换为 JavaScript 中的 Unicode 代码点编号? - How to convert one emoji character to Unicode codepoint number in JavaScript? 在JavaScript中将特殊字符转换为字符串 - Convert special character to string in javascript 如何使用 JavaScript 中的给定输入生成完全随机数组的算法?(生成随机表情符号、数字、字符、符号等) - how to make an algorithm that generates totally random arrays with a given input in JavaScript?(generate random emoji, number, character, symbol etc.) 如何在javascript中将escpaed unicode转换为emoji表情? - How to convert escpaed unicode to emoji in javascript? 如何防止✳符号转换为表情符号 - How to prevent ✳ symbol converting to emoji 如何在JavaScript中将字符串转换为符号 - How to convert a String to a Symbol in JavaScript 如何在javascript中将字符串转换为符号 - How to convert string to symbol in javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM