I want to check if a letter is a emoji. I've found some similiar questions on so and found this regex:
private final String emo_regex = "([\u20a0-\u32ff\ud83c\udc00-\ud83d\udeff\udbb9\udce5-\udbb9\udcee])";
However, when I do the following in a sentence like:
for (int k=0; k<letters.length;k++) {
if (letters[k].matches(emo_regex)) {
emoticon.add(letters[k]);
}
}
It doesn't add any letters with any emoji. I've also tried with a Matcher
and a Pattern
, but that didn't work either. Is there something wrong with the regex or am I missing something obvious in my code?
This is how I get the letter:
sentence = "Jij staat op 10 ??"
String[] letters = sentence.split("");
The last ?? should be recognized and added to emoticon
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…