Skip to content

Instantly share code, notes, and snippets.

@sylvia43
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save sylvia43/0c55f2db6af67da17df3 to your computer and use it in GitHub Desktop.

Select an option

Save sylvia43/0c55f2db6af67da17df3 to your computer and use it in GitHub Desktop.

Revisions

  1. @MobileOak MobileOak revised this gist Aug 19, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions code.java
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    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();
  2. @MobileOak MobileOak created this gist Aug 19, 2015.
    6 changes: 6 additions & 0 deletions code.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    private boolean containsEmoji(String string) {
    Pattern p = Pattern.compile("[\\uD83C-\\uDBFF\\uDC00-\\uDFFF]+");
    Matcher m = p.matcher(string);
    return m.find();

    }