public class EmojiParser
extends java.lang.Object
| 限定符和类型 | 类和说明 |
|---|---|
protected static class |
EmojiParser.AliasCandidate |
static interface |
EmojiParser.EmojiTransformer |
static class |
EmojiParser.FitzpatrickAction
Enum used to indicate what should be done when a Fitzpatrick modifier is
found.
|
static class |
EmojiParser.UnicodeCandidate |
| 构造器和说明 |
|---|
EmojiParser() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.util.List<java.lang.String> |
extractEmojis(java.lang.String input) |
protected static java.util.List<EmojiParser.AliasCandidate> |
getAliasCandidates(java.lang.String input) |
protected static int |
getEmojiEndPos(char[] text,
int startPos)
Returns end index of a unicode emoji if it is found in text starting at
index startPos, -1 if not found.
|
protected static EmojiParser.UnicodeCandidate |
getNextUnicodeCandidate(char[] chars,
int start)
Finds the next UnicodeCandidate after a given starting index
|
protected static java.util.List<EmojiParser.UnicodeCandidate> |
getUnicodeCandidates(java.lang.String input)
Generates a list UnicodeCandidates found in input string.
|
static java.lang.String |
parseFromUnicode(java.lang.String input,
EmojiParser.EmojiTransformer transformer)
Detects all unicode emojis in input string and replaces them with the
return value of transformer.transform()
|
static java.lang.String |
parseToAliases(java.lang.String input)
See
parseToAliases(String, FitzpatrickAction) with the action
"PARSE" |
static java.lang.String |
parseToAliases(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
Replaces the emoji's unicode occurrences by one of their alias
(between 2 ':').
|
static java.lang.String |
parseToHtmlDecimal(java.lang.String input)
See
parseToHtmlDecimal(String, FitzpatrickAction) with the action
"PARSE" |
static java.lang.String |
parseToHtmlDecimal(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
Replaces the emoji's unicode occurrences by their html representation.
|
static java.lang.String |
parseToHtmlHexadecimal(java.lang.String input)
See
parseToHtmlHexadecimal(String, FitzpatrickAction) with the
action "PARSE" |
static java.lang.String |
parseToHtmlHexadecimal(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
Replaces the emoji's unicode occurrences by their html hex
representation.
|
static java.lang.String |
parseToUnicode(java.lang.String input)
Replaces the emoji's aliases (between 2 ':') occurrences and the html
representations by their unicode.
|
static java.lang.String |
removeAllEmojis(java.lang.String str)
Removes all emojis from a String
|
static java.lang.String |
removeAllEmojisExcept(java.lang.String str,
java.util.Collection<Emoji> emojisToKeep)
Removes all the emojis in a String except a provided set
|
static java.lang.String |
removeEmojis(java.lang.String str,
java.util.Collection<Emoji> emojisToRemove)
Removes a set of emojis from a String
|
static java.lang.String |
replaceAllEmojis(java.lang.String str,
java.lang.String replacementString)
Replace all emojis with character
|
public static java.lang.String parseToAliases(java.lang.String input)
parseToAliases(String, FitzpatrickAction) with the action
"PARSE"input - the string to parsepublic static java.lang.String parseToAliases(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
😄 will be replaced by :smile:👦🏿 will be replaced by
:boy|type_6:👦🏿 will be replaced by :boy:👦🏿 will be replaced by :boy:🏿input - the string to parsefitzpatrickAction - the action to apply for the fitzpatrick modifierspublic static java.lang.String replaceAllEmojis(java.lang.String str,
java.lang.String replacementString)
str - the string to processreplacementString - replacement the string that will replace all the emojispublic static java.lang.String parseToUnicode(java.lang.String input)
:smile: will be replaced by 😄😄 will be replaced by 😄:boy|type_6: will be replaced by 👦🏿input - the string to parseprotected static java.util.List<EmojiParser.AliasCandidate> getAliasCandidates(java.lang.String input)
public static java.lang.String parseToHtmlDecimal(java.lang.String input)
parseToHtmlDecimal(String, FitzpatrickAction) with the action
"PARSE"input - the string to parsepublic static java.lang.String parseToHtmlDecimal(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
😄 will be replaced by 😄👦🏿 will be replaced by
👦👦🏿 will be replaced by
👦🏿input - the string to parsefitzpatrickAction - the action to apply for the fitzpatrick modifierspublic static java.lang.String parseToHtmlHexadecimal(java.lang.String input)
parseToHtmlHexadecimal(String, FitzpatrickAction) with the
action "PARSE"input - the string to parsepublic static java.lang.String parseToHtmlHexadecimal(java.lang.String input,
EmojiParser.FitzpatrickAction fitzpatrickAction)
👦 will be replaced by 👦👦🏿 will be replaced by
👦👦🏿 will be replaced by
👦🏿input - the string to parsefitzpatrickAction - the action to apply for the fitzpatrick modifierspublic static java.lang.String removeAllEmojis(java.lang.String str)
str - the string to processpublic static java.lang.String removeEmojis(java.lang.String str,
java.util.Collection<Emoji> emojisToRemove)
str - the string to processemojisToRemove - the emojis to remove from this stringpublic static java.lang.String removeAllEmojisExcept(java.lang.String str,
java.util.Collection<Emoji> emojisToKeep)
str - the string to processemojisToKeep - the emojis to keep in this stringpublic static java.lang.String parseFromUnicode(java.lang.String input,
EmojiParser.EmojiTransformer transformer)
input - the string to processtransformer - emoji transformer to apply to each emojipublic static java.util.List<java.lang.String> extractEmojis(java.lang.String input)
protected static java.util.List<EmojiParser.UnicodeCandidate> getUnicodeCandidates(java.lang.String input)
input - String to find all unicode emojis inprotected static EmojiParser.UnicodeCandidate getNextUnicodeCandidate(char[] chars, int start)
chars - char array to find UnicodeCandidate instart - starting index for searchprotected static int getEmojiEndPos(char[] text,
int startPos)
text - the current text where we are looking for an emojistartPos - the position in the text where we should start looking for
an emoji endCopyright © 2019. All Rights Reserved.