Last active
September 11, 2016 14:29
-
-
Save GiancarloGomez/cd59c68cb56647361c458f4cce0ac8b4 to your computer and use it in GitHub Desktop.
Simple function that cleans emoji's from a string using Java's String replaceAll() function. Previous to this the solution used was => https://gist.github.com/GiancarloGomez/0e76348c89df8f3b72fddfe7843cbceb (http://www.giancarlogomez.com/2016/09/emoji-support-with-coldfusion-and-mysql.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string function cleanEmojiWithColdFusion(required string value){ | |
// Match Emoticons | |
var regexEmoticons = "[\x{1F600}-\x{1F64F}]"; | |
// Match Miscellaneous Symbols and Pictographs | |
var regexSymbols = "[\x{1F300}-\x{1F5FF}]"; | |
// Match Transport And Map Symbols | |
var regexTransport = "[\x{1F680}-\x{1F6FF}]"; | |
// Return cleaned and trimmed string | |
return arguments.value | |
.replaceAll(regexEmoticons,"") | |
.replaceAll(regexSymbols,"") | |
.replaceAll(regexTransport,"") | |
.trim(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment