簡體   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";

如果要在文本中添加表情符號,可以直接將其添加到字符串中:

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

另一方面,如果文本是輸入並且您希望提取表情符號,則可以使用此包:

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

ES6/ES2015 引入了一種在星體平面中表示 Unicode 點的方法(任何需要超過 4 個字符的 Unicode 代碼點),通過將代碼包裝在圖形括號中:

格式: \\u{XXXXX}

例如:

\\u{1F436}會起作用,並且會出現一個狗表情符號

作為參考,您可以查看此鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM