Java filters emoji Emoticons to find the Unicode range of the emoji.

Source: Internet
Author: User


/*** Filter Emoji expression *@authorKunjie * July 17, 2015*/ Public classEmojifilter { Public Static voidMain (string[] args) {System.out.println ("Ah, Assad, Qinnuanl.")); } Public Staticstring Filter (String str) {if(str = =NULL|| Str.length () = = 0){ return""; } stringbuffer SB=NewStringBuffer (); for(intI=0;i<str.length () -1;i++){ intCH =Str.charat (i); intmin = Integer.parseint ("E001", 16); intmax = Integer.parseint ("E537", 16); if(ch >= min && ch <=max) {Sb.append (""); }Else{sb.append (Char) ch); } } returnsb.tostring (); } }

Each expression has a SB Unicode encoding.

such as the sun expression, then SB code for E04A, is 16 binary.

Find the smallest E001, E537,

It is then converted to a 10 binary comparison size. Within this range, it is the emoji expression character.

Java filters emoji Emoticons to find the Unicode range of the emoji.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.