Skip to content

A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis

Notifications You must be signed in to change notification settings

hero-page/hero-emoji-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This entire repository was created completely with AI, using the hero-ai-package-creator, which is open-source, uses GPT-4, and is written & maintained by Sam Chahine ❣️🧞‍♀️

hero-emoji-strings

A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis.

Functions

emojiCount

Counts the number of emojis in a given string. Handles Unicode and shortcodes emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters, strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

replaceEmoji

Replaces all occurrences of a specific emoji in a string with another string (could be another emoji). Test cases: strings with single emoji, multiple emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid input emoji.

splitByEmoji

Splits a string into an array of strings divided by emojis. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and strings with various delimiters. Extreme cases: strings with special characters and long strings with emojis. Ignored cases: malformed shortcodes.

emojiPositions

Returns an array of positions where emojis are found in a string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters and strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

removeEmoji

Removes all emojis from a given string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters and strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

emojify

Converts a string with shortcodes to a string with actual emojis. Test cases: strings with shortcodes, no shortcodes, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: malformed shortcodes.

shortcodeify

Converts a string with emojis to a string with shortcodes. Test cases: strings with emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: unrecognizable emoji shortcodes.

isValidEmoji

Checks if a given string is a valid emoji. Test cases: valid Unicode and shortcode emojis, invalid emojis, and mixed character types. Extreme cases: special characters. Ignored cases: malformed shortcodes.

getContainedEmojis

Returns an array of distinct emojis contained in a given string. Test cases: single emojis, strings with no emojis, strings with mixed emojis, and long strings with emojis. Extreme cases: strings with special characters, strings with a mixture of letters, numbers, and emojis. Ignored cases: malformed shortcodes.

substringWithEmoji

Returns a substring of the given string while treating emojis as single characters. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid indices.

lengthWithEmoji

Returns the length of the given string treating emojis as single characters. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: malformed shortcodes.

indexOfEmoji

Returns the index of the first occurrence of the emoji in the given string or -1 if not present. Test cases: strings with single emojis, multiple emojis, no emojis, and mixed character types. Extreme cases: large strings and special characters. Ignored cases: invalid input emoji.

Author

Sam Chahine, at Hero

Tests for emojiCount

emojiCount

Tests for emojify

emojify

Tests for lengthWithEmoji

lengthWithEmoji

Tests for removeEmoji

removeEmoji

Tests for replaceEmoji

replaceEmoji

Tests for shortcodeify

shortcodeify

Tests for substringWithEmoji

substringWithEmoji

Tests for indexOfEmoji

indexOfEmoji

Tests for isValidEmoji

isValidEmoji

Tests for getContainedEmojis

getContainedEmojis

About

A library to manage strings with emojis, making it easier to manipulate, count and sanitize strings that contain emojis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published