/** * Get emoji by unicode, short code, decimal html entity or hexadecimal html * entity * * @param code unicode, short code, decimal html entity or hexadecimal html * @return Emoji */ public static Emoji getEmoji(String code) { Matcher m = shortCodePattern.matcher(code); // test for shortcode with colons if (m.find()) { code = m.group(1); } Emoji emoji = selectFirst( EmojiManager.data(), having(on(Emoji.class).getEmoji(), Matchers.equalTo(code)).or(having(on(Emoji.class).getEmoji(), Matchers.equalTo(code))) .or(having(on(Emoji.class).getHexHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalSurrogateHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getHexHtmlShort(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalHtmlShort(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getAliases(), Matchers.hasItem(code))) .or(having(on(Emoji.class).getEmoticons(), Matchers.hasItem(code)))); return emoji; }
/** * Get emoji by unicode, short code, decimal html entity or hexadecimal html * entity * * @param code unicode, short code, decimal html entity or hexadecimal html * @return Emoji */ public static Emoji getEmoji(String code) { Matcher m = shortCodePattern.matcher(code); // test for shortcode with colons if (m.find()) { code = m.group(1); } Emoji emoji = selectFirst( EmojiManager.data(), having(on(Emoji.class).getEmoji(), Matchers.equalTo(code)).or(having(on(Emoji.class).getEmoji(), Matchers.equalTo(code))) .or(having(on(Emoji.class).getHexHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalSurrogateHtml(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getHexHtmlShort(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getDecimalHtmlShort(), Matchers.equalToIgnoringCase(code))) .or(having(on(Emoji.class).getAliases(), Matchers.hasItem(code))) .or(having(on(Emoji.class).getEmoticons(), Matchers.hasItem(code)))); return emoji; }