public final class EmojiManager extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsEmoji(String text)
Checks if the given text contains emojis.
|
static Set<Emoji> |
extractEmojis(String text)
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<IndexedEmoji> |
extractEmojisInOrderWithIndex(String text)
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 List<Emoji> |
getAllEmojisLengthDescending()
Gets all emojis in descending order by their char length.
|
static Optional<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> |
getBySlackAlias(String alias)
Gets an emoji for the given Slack alias 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 |
removeAllEmojisExcept(String text,
Collection<Emoji> emojisToKeep)
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,
Emoji... emojisToRemove)
Removes the given emojis from the given text.
|
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,
String replacementString)
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,
Emoji... emojisToReplace)
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,
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 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> 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 containsEmoji(String text)
text - The text to check.public static List<Emoji> extractEmojisInOrder(String text)
text - The text to extract emojis from.public static List<IndexedEmoji> extractEmojisInOrderWithIndex(String text)
text - The text to extract emojis from.public static Set<Emoji> extractEmojis(String text)
text - The text to extract emojis from.public static String removeAllEmojis(String text)
text - The text to remove emojis from.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 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 replaceAllEmojis(String text, String replacementString)
text - The text to replace emojis from.replacementString - The replacement string.public static String replaceAllEmojis(String text, Function<Emoji,String> replacementFunction)
text - The text to replace emojis from.replacementFunction - The replacement function.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, 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, Emoji... emojisToReplace)
text - The text to replace emojis from.replacementFunction - The replacement function.emojisToReplace - The emojis to replace.