Skip to content

Instantly share code, notes, and snippets.

@sylvia43
Last active August 29, 2015 14:27
Show Gist options
  • Save sylvia43/0c55f2db6af67da17df3 to your computer and use it in GitHub Desktop.
Save sylvia43/0c55f2db6af67da17df3 to your computer and use it in GitHub Desktop.
private boolean containsEmoji(String string) {
// if you're doing it frequently, move the pattern compile into a static / member variable instead
Pattern p = Pattern.compile("[\\uD83C-\\uDBFF\\uDC00-\\uDFFF]+");
Matcher m = p.matcher(string);
return m.find();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment