Skip to content
/ cf-emoji-java Public template

ColdFusion wrapper for emoji-java to identify, sanitize and convert emojis in CFML projects.

License

Notifications You must be signed in to change notification settings

JamoCA/cf-emoji-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cf-emoji-java

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.

Installation

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.)

Usage

Instantiate the component:

emojijava = new emojijava();

emojijava.getForAlias(alias);

Returns a structure containing data associated with the given alias.

emojijava.getForAlias('smiley');

emojijava.getForTag(tag);

Returns an array of structures containing data associated with the given tag.

emojijava.getForTag('happy');

emojijava.getAllTags();

Returns an array with all emoji tags.

emojijava.getAllTags();

emojijava.getAll();

Returns an array with all the emoji structs.

emojijava.getAll();

emojijava.isEmoji(text);

Returns true/false if a string is an emoji.

emojijava.isEmoji('❤️');       // true
emojijava.isEmoji('I ❤️ 🍕');  // false

emojijava.containsEmoji(text);

Returns true/false if a string contains any emoji.

emojijava.containsEmoji('I ❤️ 🍕');  // true

emojijava.isOnlyEmojis(text);

Returns true/false if the entire string is composed of only emojis.

emojijava.isOnlyEmojis('I ❤️ 🍕');   // false
emojijava.isOnlyEmojis('👁 ❤️ 🍕');  // true

emojijava.parseToAliases(text);

Replaces all the emoji's unicodes found in a string by their aliases.

emojijava.parseToAliases('I like 🍕');   // I like :pizza:

emojijava.parseToHtmlDecimal(text);

Replace all the emoji's unicodes found in a string by their HTML decimal representation.

emojijava.parseToHtmlDecimal('I ❤️ 🍕');   // I ❤️ 🍕

emojijava.parseToHtmlHexadecimal(text);

Replaces all the emoji's unicodes found in a string by their HTML hex representation.

emojijava.parseToHtmlHexadecimal('I ❤️ 🍕');   // I ❤️ 🍕

emojijava.removeAllEmojis(text);

Returns a string with all emojis removed.

emojijava.removeAllEmojis('I ❤️ 🍕');   // I

emojijava.removeAllEmojisExcept(text, emojisToKeep);

Removes all emojis from the String, except the ones in the emojisToKeep (list or array). Use 'alias'.

emojijava.removeAllEmojisExcept('I ❤️ 🍕', "pizza");   // I  🍕

emojijava.removeEmojis(text, emojisToRemove);

Removes emojis listed in the emojisToRemove parameter (list or array) from the string. Use 'alias'.

emojijava.removeEmojis(text, "pizza");  // I ❤️

emojijava.replaceAllEmojis(text, replacementText)

Replaces all emojis with text string with the replacementText string.

emojijava.removeEmojis('I ❤️ 🍕', "[emoji]");  // I [emoji] [emoji]

emojijava.extractEmojis(text, returnAsStruct);

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

Acknowledgements

cf-emoji-java uses the java library provided by the github/vdurmont/emoji-java project.

About

ColdFusion wrapper for emoji-java to identify, sanitize and convert emojis in CFML projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published