Android的 - 如何从一个字符串过滤表情符号(表情)? [英] Android - How to filter emoji (emoticons) from a string?

查看:917
本文介绍了Android的 - 如何从一个字符串过滤表情符号(表情)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个Android应用程序,我不希望人们使用表情符号输入。

I'm working on an Android app, and I do not want people to use emoji in the input.

我如何从一个字符串中删除字符表情符号?

How can I remove emoji characters from a string?

推荐答案

Emojis可以在以下范围内找到(的 ):

Emojis can be found in the following ranges (source) :

  • U + 2190至U + 21FF
  • U + 2600至U + 26FF
  • U + 2700至U + 27BF
  • U + 3000到U + 303F
  • U + 1F300至U + 1F64F
  • U + 1F680至U + 1F6FF

您可以使用此行要在脚本中一次筛选它们:

You can use this line in your script to filter them all at once:

<$c$c>text.replace("/[\u2190-\u21FF]|[\u2600-\u26FF]|[\u2700-\u27BF]|[\u3000-\u303F]|[\u1F300-\u1F64F]|[\u1F680-\u1F6FF]/g", );

这篇关于Android的 - 如何从一个字符串过滤表情符号(表情)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆