public final class EmojiManager extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsAnyEmoji(String text)
Checks if the given text contains emojis.
|
static boolean |
containsAnyEmoji(String text,
EnumSet<EmojiType> emojiType)
Checks if the given text contains emojis.
|
static Set<String> |
extractAliases(String text)
Extracts all aliases from the given text.
|
static List<String> |
extractAliasesInOrder(String text)
Extracts all aliases from the given text in the order they appear.
|
static List<IndexedAlias> |
extractAliasesInOrderWithIndex(String text)
Extracts all aliases from the given text in the order they appear.
|
static Set<Emoji> |
extractEmojis(String text)
Extracts all emojis from the given text.
|
static Set<Emoji> |
extractEmojis(String text,
EnumSet<EmojiType> emojiType)
Extracts all emojis from the given text.
|
static List<Emoji> |
extractEmojisInOrder(String text)
Extracts all emojis from the given text in the order they appear.
|
static List<Emoji> |
extractEmojisInOrder(String text,
EnumSet<EmojiType> emojiType)
Extracts all emojis from the given text in the order they appear.
|
static List<IndexedEmoji> |
extractEmojisInOrderWithIndex(String text)
Extracts all emojis from the given text in the order they appear.
|
static List<IndexedEmoji> |
extractEmojisInOrderWithIndex(String text,
EnumSet<EmojiType> emojiType)
Extracts all emojis from the given text in the order they appear.
|
static Set<Emoji> |
getAllEmojis()
Gets all emojis.
|
static Set<Emoji> |
getAllEmojisByGroup(EmojiGroup group)
Gets all emojis that are part of the given group.
|
static Set<Emoji> |
getAllEmojisBySubGroup(EmojiSubGroup subgroup)
Gets all emojis that are part of the given subgroup.
|
static Map<EmojiGroup,Set<Emoji>> |
getAllEmojisGrouped()
Gets all emojis mapped to their group.
|
static List<Emoji> |
getAllEmojisLengthDescending()
Gets all emojis in descending order by their char length.
|
static Map<EmojiSubGroup,Set<Emoji>> |
getAllEmojisSubGrouped()
Gets all emojis mapped to their subgroup.
|
static Optional<List<Emoji>> |
getByAlias(String alias)
Gets an emoji for the given alias i.e.
|
static Optional<Emoji> |
getByDiscordAlias(String alias)
Gets an emoji for the given Discord alias i.e.
|
static Optional<Emoji> |
getByGithubAlias(String alias)
Gets an emoji for the given GitHub alias i.e.
|
static Optional<Emoji> |
getByHtmlDecimal(String htmlDecimal)
Gets an emoji for the given HTML decimal i.e.
|
static Optional<Emoji> |
getByHtmlHexadecimal(String htmlHexadecimal)
Gets an emoji for the given HTML hexadecimal i.e.
|
static Optional<Emoji> |
getBySlackAlias(String alias)
Gets an emoji for the given Slack alias i.e.
|
static Optional<Emoji> |
getByUrlEncoded(String urlEncodedEmoji)
Gets an emoji for the given url encoded emoji i.e.
|
static Optional<Emoji> |
getEmoji(String emoji)
Returns the emoji for the given Unicode.
|
static Pattern |
getEmojiPattern()
Gets the pattern checking for all emojis.
|
static boolean |
isEmoji(String emoji)
Check if the given string is an emoji.
|
static String |
removeAllEmojis(String text)
Removes all emojis from the given text.
|
static String |
removeAllEmojis(String text,
EnumSet<EmojiType> emojiType)
Removes all emojis from the given text.
|
static String |
removeAllEmojisExcept(String text,
Collection<Emoji> emojisToKeep)
Removes all emojis except the given emojis from the given text.
|
static String |
removeAllEmojisExcept(String text,
Collection<Emoji> emojisToKeep,
EnumSet<EmojiType> emojiType)
Removes all emojis except the given emojis from the given text.
|
static String |
removeAllEmojisExcept(String text,
Emoji... emojisToKeep)
Removes all emojis except the given emojis from the given text.
|
static String |
removeEmojis(String text,
Collection<Emoji> emojisToRemove)
Removes the given emojis from the given text.
|
static String |
removeEmojis(String text,
Collection<Emoji> emojisToRemove,
EnumSet<EmojiType> emojiType)
Removes the given emojis from the given text.
|
static String |
removeEmojis(String text,
Emoji... emojisToRemove)
Removes the given emojis from the given text.
|
static String |
replaceAliases(String text,
BiFunction<String,List<Emoji>,String> replacementFunction)
Replaces all aliases in the text with the given replacement function.
|
static String |
replaceAllEmojis(String text,
Function<Emoji,String> replacementFunction)
Replaces all emojis in the text with the given replacement function.
|
static String |
replaceAllEmojis(String text,
Function<Emoji,String> replacementFunction,
EnumSet<EmojiType> emojiType)
Replaces all emojis in the text with the given replacement function.
|
static String |
replaceAllEmojis(String text,
String replacementString)
Replaces all emojis in the text with the given replacement string.
|
static String |
replaceAllEmojis(String text,
String replacementString,
EnumSet<EmojiType> emojiType)
Replaces all emojis in the text with the given replacement string.
|
static String |
replaceEmojis(String text,
Function<Emoji,String> replacementFunction,
Collection<Emoji> emojisToReplace)
Replaces all emojis in the text with the given replacement function.
|
static String |
replaceEmojis(String text,
Function<Emoji,String> replacementFunction,
Collection<Emoji> emojisToReplace,
EnumSet<EmojiType> emojiType)
Replaces all emojis in the text with the given replacement function.
|
static String |
replaceEmojis(String text,
String replacementString,
Collection<Emoji> emojisToReplace)
Replaces the given emojis with the given replacement string.
|
static String |
replaceEmojis(String text,
String replacementString,
Collection<Emoji> emojisToReplace,
EnumSet<EmojiType> emojiType)
Replaces the given emojis with the given replacement string.
|
static String |
replaceEmojis(String text,
String replacementString,
Emoji... emojisToReplace)
Replaces the given emojis with the given replacement string.
|
public static Optional<Emoji> getEmoji(String emoji)
emoji - The Unicode of the emoji.public static boolean isEmoji(String emoji)
emoji - The emoji to check.public static Map<EmojiGroup,Set<Emoji>> getAllEmojisGrouped()
public static Map<EmojiSubGroup,Set<Emoji>> getAllEmojisSubGrouped()
public static Set<Emoji> getAllEmojisByGroup(EmojiGroup group)
group - The group to get the emojis for.public static Set<Emoji> getAllEmojisBySubGroup(EmojiSubGroup subgroup)
subgroup - The subgroup to get the emojis for.public static List<Emoji> getAllEmojisLengthDescending()
public static Optional<Emoji> getByHtmlDecimal(String htmlDecimal)
htmlDecimal - The HTML decimal of the emoji.public static Optional<Emoji> getByHtmlHexadecimal(String htmlHexadecimal)
htmlHexadecimal - The HTML hexadecimal of the emoji.public static Optional<Emoji> getByUrlEncoded(String urlEncodedEmoji)
urlEncodedEmoji - The HTML hexadecimal of the emoji.public static Optional<List<Emoji>> getByAlias(String alias)
alias - The alias of the emoji.public static Optional<Emoji> getByDiscordAlias(String alias)
alias - The Discord alias of the emoji.public static Optional<Emoji> getByGithubAlias(String alias)
alias - The GitHub alias of the emoji.public static Optional<Emoji> getBySlackAlias(String alias)
alias - The Slack alias of the emoji.public static Pattern getEmojiPattern()
public static boolean containsAnyEmoji(String text)
text - The text to check.public static boolean containsAnyEmoji(String text, EnumSet<EmojiType> emojiType)
text - The text to check.emojiType - The type of the emoji appearance in the string which should be checked against.public static Set<Emoji> extractEmojis(String text)
text - The text to extract emojis from.public static Set<Emoji> extractEmojis(String text, EnumSet<EmojiType> emojiType)
text - The text to extract emojis from.emojiType - The type of the emoji appearance in the string which should be extracted.public static List<Emoji> extractEmojisInOrder(String text)
text - The text to extract emojis from.public static List<Emoji> extractEmojisInOrder(String text, EnumSet<EmojiType> emojiType)
text - The text to extract emojis from.emojiType - The type of the emoji appearance in the string which should be extracted.public static List<IndexedEmoji> extractEmojisInOrderWithIndex(String text)
text - The text to extract emojis from.public static List<IndexedEmoji> extractEmojisInOrderWithIndex(String text, EnumSet<EmojiType> emojiType)
text - The text to extract emojis from.emojiType - The type of the emoji appearance in the string which should be extracted.public static String removeAllEmojis(String text)
text - The text to remove emojis from.public static String removeAllEmojis(String text, EnumSet<EmojiType> emojiType)
text - The text to remove emojis from.emojiType - The type of the emoji appearance in the string which should be removed.public static String removeEmojis(String text, Emoji... emojisToRemove)
text - The text to remove emojis from.emojisToRemove - The emojis to remove.public static String removeEmojis(String text, Collection<Emoji> emojisToRemove)
text - The text to remove emojis from.emojisToRemove - The emojis to remove.public static String removeEmojis(String text, Collection<Emoji> emojisToRemove, EnumSet<EmojiType> emojiType)
text - The text to remove emojis from.emojisToRemove - The emojis to remove.emojiType - The type of the emoji appearance in the string which should be removed.public static String removeAllEmojisExcept(String text, Emoji... emojisToKeep)
text - The text to remove emojis from.emojisToKeep - The emojis to keep.public static String removeAllEmojisExcept(String text, Collection<Emoji> emojisToKeep)
text - The text to remove emojis from.emojisToKeep - The emojis to keep.public static String removeAllEmojisExcept(String text, Collection<Emoji> emojisToKeep, EnumSet<EmojiType> emojiType)
text - The text to remove emojis from.emojisToKeep - The emojis to keep.emojiType - The type of the emoji appearance in the string which should be removed.public static String replaceAllEmojis(String text, String replacementString)
text - The text to replace emojis from.replacementString - The replacement string.public static String replaceAllEmojis(String text, String replacementString, EnumSet<EmojiType> emojiType)
text - The text to replace emojis from.replacementString - The replacement string.emojiType - The type of the emoji appearance in the string which should be replaced.public static String replaceAllEmojis(String text, Function<Emoji,String> replacementFunction)
text - The text to replace emojis from.replacementFunction - The replacement function.public static String replaceAllEmojis(String text, Function<Emoji,String> replacementFunction, EnumSet<EmojiType> emojiType)
text - The text to replace emojis from.replacementFunction - The replacement function.emojiType - The type of the emoji appearance in the string which should be replaced.public static String replaceEmojis(String text, String replacementString, Collection<Emoji> emojisToReplace)
text - The text to replace emojis from.replacementString - The replacement string.emojisToReplace - The emojis to replace.public static String replaceEmojis(String text, String replacementString, Collection<Emoji> emojisToReplace, EnumSet<EmojiType> emojiType)
text - The text to replace emojis from.replacementString - The replacement string.emojisToReplace - The emojis to replace.emojiType - The type of the emoji appearance in the string which should be replaced.public static String replaceEmojis(String text, String replacementString, Emoji... emojisToReplace)
text - The text to replace emojis from.replacementString - The replacement string.emojisToReplace - The emojis to replace.public static String replaceEmojis(String text, Function<Emoji,String> replacementFunction, Collection<Emoji> emojisToReplace)
text - The text to replace emojis from.replacementFunction - The replacement function.emojisToReplace - The emojis to replace.public static String replaceEmojis(String text, Function<Emoji,String> replacementFunction, Collection<Emoji> emojisToReplace, EnumSet<EmojiType> emojiType)
text - The text to replace emojis from.replacementFunction - The replacement function.emojisToReplace - The emojis to replace.emojiType - The type of the emoji appearance in the string which should be replaced.public static String replaceAliases(String text, BiFunction<String,List<Emoji>,String> replacementFunction)
text - The text to replace aliases from.replacementFunction - A non-empty list.
Always contains at least one emoji, but there may be more than 1 available for one alias.
Therefore, it's up to you to decide which one you take.
For example, when replacing the alias ":beach_umbrella:", these two emojis will be available. {emoji='🏖️', unicode='🏖️', discordAliases=[:beach:, :beach_with_umbrella:], githubAliases=[:beach_umbrella:], slackAliases=[:beach_with_umbrella:], hasFitzpatrick=false, hasHairStyle=false, version=0.7, qualification=FULLY_QUALIFIED, description='beach with umbrella', group=TRAVEL_AND_PLACES, subgroup=PLACE_GEOGRAPHIC, hasVariationSelectors=false, allAliases=[:beach:, :beach_umbrella:, :beach_with_umbrella:]}, {emoji='⛱️', unicode='⛱️', discordAliases=[:beach_umbrella:, :umbrella_on_ground:], githubAliases=[:parasol_on_ground:], slackAliases=[:umbrella_on_ground:], hasFitzpatrick=false, hasHairStyle=false, version=0.7, qualification=FULLY_QUALIFIED, description='umbrella on ground', group=TRAVEL_AND_PLACES, subgroup=SKY_AND_WEATHER, hasVariationSelectors=false, allAliases=[:beach_umbrella:, :umbrella_on_ground:, :parasol_on_ground:]}
public static Set<String> extractAliases(String text)
text - The text to extract aliases from.public static List<String> extractAliasesInOrder(String text)
text - The text to extract aliases from.public static List<IndexedAlias> extractAliasesInOrderWithIndex(String text)
text - The text to extract aliases from.