Emoji filtering

   isNotEmojiCharacter( (codePoint == 0x0) ||== 0x9) ||== 0xA) ||== 0xD) ||>= 0x20) && (codePoint <= 0xD7FF)) ||>= 0xE000) && (codePoint <= 0xFFFD)) ||>= 0x10000) && (codePoint <= 0x10FFFF<span style="color: #008000;">/**<span style="color: #008000;">

  • 过滤emoji 或者 其他非文字类型的字符
  • <span style="color: #808080;">@param<span style="color: #008000;"> source
  • <span style="color: #808080;">@return
    <span style="color: #008000;">*/
    <span style="color: #0000ff;">public <span style="color: #0000ff;">static<span style="color: #000000;"> String filterEmoji(String source)
    {
    <span style="color: #0000ff;">int len =<span style="color: #000000;"> source.length();
    StringBuilder buf = <span style="color: #0000ff;">new<span style="color: #000000;"> StringBuilder(len);
    <span style="color: #0000ff;">for (<span style="color: #0000ff;">int i = 0; i < len; i++<span style="color: #000000;">)
    {
    <span style="color: #0000ff;">char codePoint =<span style="color: #000000;"> source.charAt(i);
    <span style="color: #0000ff;">if<span style="color: #000000;"> (isNotEmojiCharacter(codePoint))
    {
    buf.append(codePoint);
    }
    }
    <span style="color: #0000ff;">return buf.toString();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>