ColdFusion wrapper for emoji-java (a lightweight java library that helps you use Emojis in your java applications) to identify, sanitize and convert emojis for CFML projects.
Download the JAR file directly from the emoji-java's releases tab on GitHub. Add the JAR file to the global Java classpath, use javaSettings in application.cfc or use JavaLoader.)
Instantiate the component:
emojijava = new emojijava();
Returns a structure containing data associated with the given alias.
emojijava.getForAlias('smiley');
Returns an array of structures containing data associated with the given tag.
emojijava.getForTag('happy');
Returns an array with all emoji tags.
emojijava.getAllTags();
Returns an array with all the emoji structs.
emojijava.getAll();
Returns true/false if a string is an emoji.
emojijava.isEmoji('❤️'); // true
emojijava.isEmoji('I ❤️ 🍕'); // false
Returns true/false if a string contains any emoji.
emojijava.containsEmoji('I ❤️ 🍕'); // true
Returns true/false if the entire string is composed of only emojis.
emojijava.isOnlyEmojis('I ❤️ 🍕'); // false
emojijava.isOnlyEmojis('👁 ❤️ 🍕'); // true
Replaces all the emoji's unicodes found in a string by their aliases.
emojijava.parseToAliases('I like 🍕'); // I like :pizza:
Replace all the emoji's unicodes found in a string by their HTML decimal representation.
emojijava.parseToHtmlDecimal('I ❤️ 🍕'); // I ❤️ 🍕
Replaces all the emoji's unicodes found in a string by their HTML hex representation.
emojijava.parseToHtmlHexadecimal('I ❤️ 🍕'); // I ❤️ 🍕
Returns a string with all emojis removed.
emojijava.removeAllEmojis('I ❤️ 🍕'); // I
Removes all emojis from the String, except the ones in the emojisToKeep
(list or array). Use 'alias'.
emojijava.removeAllEmojisExcept('I ❤️ 🍕', "pizza"); // I 🍕
Removes emojis listed in the emojisToRemove
parameter (list or array) from the string. Use 'alias'.
emojijava.removeEmojis(text, "pizza"); // I ❤️
Replaces all emojis with text string with the replacementText string.
emojijava.removeEmojis('I ❤️ 🍕', "[emoji]"); // I [emoji] [emoji]
Returns an array or array of structures of emoji data identified from the string.
emojijava.extractEmojis('I ❤️ 🍕'); // I ["❤️", "🍕"]
emojijava.extractEmojis('I ❤️ 🍕', true); // an array of structs w/emoji data
cf-emoji-java uses the java library provided by the github/vdurmont/emoji-java project.