Forgot password?
 Create new account
View 89|Reply 1

Emoji替换為黑白的

[Copy link]

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2024-2-10 19:51:57 |Read mode
将字符串中的Emoji替换為黑白的。例如:
1+1=3? ❌
2+2=3? ❌
Javascript:'1+1=3? ❌\n2+2=3? ❌'.replace(/\p{Emoji}/gu,'$&\uFE0E')
输出
1+1=3? ❌︎
2+2=3? ❌︎

developer.mozilla.org/en-US/docs/Web/CSS/font-variant-emoji

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2024-2-10 20:15:35
\p{Emoji}把數字0-9也匹配了,應該用\p{Extended_Pictographic}
stackoverflow.com/questions/64389323/why-do-u … scapes-match-numbers

手机版Mobile version|Leisure Math Forum

2025-4-20 22:04 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list