{"id":13565440,"url":"https://github.com/vdurmont/emoji-java","last_synced_at":"2025-05-14T00:06:13.051Z","repository":{"id":21006412,"uuid":"24297039","full_name":"vdurmont/emoji-java","owner":"vdurmont","description":"The missing emoji library for Java :heart:","archived":false,"fork":false,"pushed_at":"2024-03-29T19:35:14.000Z","size":539,"stargazers_count":2637,"open_issues_count":83,"forks_count":518,"subscribers_count":109,"default_branch":"master","last_synced_at":"2025-04-10T15:57:16.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdurmont.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-21T16:58:57.000Z","updated_at":"2025-04-08T02:05:23.000Z","dependencies_parsed_at":"2024-08-01T13:22:17.943Z","dependency_job_id":"999bf244-fa9d-4e1d-87b7-b74792b25a59","html_url":"https://github.com/vdurmont/emoji-java","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdurmont%2Femoji-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdurmont%2Femoji-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdurmont%2Femoji-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdurmont%2Femoji-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdurmont","download_url":"https://codeload.github.com/vdurmont/emoji-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043478,"owners_count":22004958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:47.005Z","updated_at":"2025-05-14T00:06:13.025Z","avatar_url":"https://github.com/vdurmont.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# emoji-java\n\n[![Build Status](https://travis-ci.org/vdurmont/emoji-java.svg?branch=master)](https://travis-ci.org/vdurmont/emoji-java)\n[![Coverage Status](https://img.shields.io/coveralls/vdurmont/emoji-java.svg)](https://coveralls.io/r/vdurmont/emoji-java?branch=master)\n[![License Info](http://img.shields.io/badge/license-The%20MIT%20License-brightgreen.svg)](https://github.com/vdurmont/emoji-java/blob/master/LICENSE.md)\n\n_The missing emoji library for java._\n\n**emoji-java** is a lightweight java library that helps you use Emojis in your java applications.\n\n## How to get it?\n\n##### Via Maven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.vdurmont\u003c/groupId\u003e\n  \u003cartifactId\u003eemoji-java\u003c/artifactId\u003e\n  \u003cversion\u003e5.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nYou can also download the project, build it with `mvn clean install` and add the generated jar to your buildpath.\n\n##### Via Gradle:\n\n```gradle\ncompile 'com.vdurmont:emoji-java:5.1.1'\n```\n\n##### Via Direct Download:\n\n- Use [releases](https://github.com/vdurmont/emoji-java/releases) tab to download the jar directly.\n- Download JSON-java dependency from http://mvnrepository.com/artifact/org.json/json.\n\n## How to use it?\n\n### EmojiManager\n\nThe `EmojiManager` provides several static methods to search through the emojis database:\n\n- `getForTag` returns all the emojis for a given tag\n- `getForAlias` returns the emoji for an alias\n- `getAll` returns all the emojis\n- `isEmoji` checks if a string is an emoji\n- `containsEmoji` checks if a string contains any emoji\n\nYou can also query the metadata:\n\n- `getAllTags` returns the available tags\n\nOr get everything:\n\n- `getAll` returns all the emojis\n\n### Emoji model\n\nAn `Emoji` is a POJO (plain old java object), which provides the following methods:\n\n- `getUnicode` returns the unicode representation of the emoji\n- `getUnicode(Fitzpatrick)` returns the unicode representation of the emoji with the provided Fitzpatrick modifier. If the emoji doesn't support the Fitzpatrick modifiers, this method will throw an `UnsupportedOperationException`. If the provided Fitzpatrick is null, this method will return the unicode of the emoji.\n- `getDescription` returns the (optional) description of the emoji\n- `getAliases` returns a list of aliases for this emoji\n- `getTags` returns a list of tags for this emoji\n- `getHtmlDecimal` returns an html decimal representation of the emoji\n- `getHtmlHexadecimal` returns an html decimal representation of the emoji\n- `supportsFitzpatrick` returns true if the emoji supports the Fitzpatrick modifiers, else false\n\n### Fitzpatrick modifiers\n\nSome emojis now support the use of Fitzpatrick modifiers that gives the choice between 5 shades of skin tones:\n\n| Modifier | Type     |\n| :------: | -------- |\n|    🏻    | type_1_2 |\n|    🏼    | type_3   |\n|    🏽    | type_4   |\n|    🏾    | type_5   |\n|    🏿    | type_6   |\n\nWe defined the format of the aliases including a Fitzpatrick modifier as:\n\n```\n:ALIAS|TYPE:\n```\n\nA few examples:\n\n```\n:boy|type_1_2:\n:swimmer|type_4:\n:santa|type_6:\n```\n\n### EmojiParser\n\n#### To unicode\n\nTo replace all the aliases and the html representations found in a string by their unicode, use `EmojiParser#parseToUnicode(String)`.\n\nFor example:\n\n```java\nString str = \"An :grinning:awesome :smiley:string \u0026#128516;with a few :wink:emojis!\";\nString result = EmojiParser.parseToUnicode(str);\nSystem.out.println(result);\n// Prints:\n// \"An 😀awesome 😃string 😄with a few 😉emojis!\"\n```\n\n#### To aliases\n\nTo replace all the emoji's unicodes found in a string by their aliases, use `EmojiParser#parseToAliases(String)`.\n\nFor example:\n\n```java\nString str = \"An 😀awesome 😃string with a few 😉emojis!\";\nString result = EmojiParser.parseToAliases(str);\nSystem.out.println(result);\n// Prints:\n// \"An :grinning:awesome :smiley:string with a few :wink:emojis!\"\n```\n\nBy default, the aliases will parse and include any Fitzpatrick modifier that would be provided. If you want to remove or ignore the Fitzpatrick modifiers, use `EmojiParser#parseToAliases(String, FitzpatrickAction)`. Examples:\n\n```java\nString str = \"Here is a boy: \\uD83D\\uDC66\\uD83C\\uDFFF!\";\nSystem.out.println(EmojiParser.parseToAliases(str));\nSystem.out.println(EmojiParser.parseToAliases(str, FitzpatrickAction.PARSE));\n// Prints twice: \"Here is a boy: :boy|type_6:!\"\nSystem.out.println(EmojiParser.parseToAliases(str, FitzpatrickAction.REMOVE));\n// Prints: \"Here is a boy: :boy:!\"\nSystem.out.println(EmojiParser.parseToAliases(str, FitzpatrickAction.IGNORE));\n// Prints: \"Here is a boy: :boy:🏿!\"\n```\n\n#### To html\n\nTo replace all the emoji's unicodes found in a string by their html representation, use `EmojiParser#parseToHtmlDecimal(String)` or `EmojiParser#parseToHtmlHexadecimal(String)`.\n\nFor example:\n\n```java\nString str = \"An 😀awesome 😃string with a few 😉emojis!\";\n\nString resultDecimal = EmojiParser.parseToHtmlDecimal(str);\nSystem.out.println(resultDecimal);\n// Prints:\n// \"An \u0026#128512;awesome \u0026#128515;string with a few \u0026#128521;emojis!\"\n\nString resultHexadecimal = EmojiParser.parseToHtmlHexadecimal(str);\nSystem.out.println(resultHexadecimal);\n// Prints:\n// \"An \u0026#x1f600;awesome \u0026#x1f603;string with a few \u0026#x1f609;emojis!\"\n```\n\nBy default, any Fitzpatrick modifier will be removed. If you want to ignore the Fitzpatrick modifiers, use `EmojiParser#parseToAliases(String, FitzpatrickAction)`. Examples:\n\n```java\nString str = \"Here is a boy: \\uD83D\\uDC66\\uD83C\\uDFFF!\";\nSystem.out.println(EmojiParser.parseToHtmlDecimal(str));\nSystem.out.println(EmojiParser.parseToHtmlDecimal(str, FitzpatrickAction.PARSE));\nSystem.out.println(EmojiParser.parseToHtmlDecimal(str, FitzpatrickAction.REMOVE));\n// Print 3 times: \"Here is a boy: \u0026#128102;!\"\nSystem.out.println(EmojiParser.parseToHtmlDecimal(str, FitzpatrickAction.IGNORE));\n// Prints: \"Here is a boy: \u0026#128102;🏿!\"\n```\n\nThe same applies for the methods `EmojiParser#parseToHtmlHexadecimal(String)` and `EmojiParser#parseToHtmlHexadecimal(String, FitzpatrickAction)`.\n\n#### Remove emojis\n\nYou can easily remove emojis from a string using one of the following methods:\n\n- `EmojiParser#removeAllEmojis(String)`: removes all the emojis from the String\n- `EmojiParser#removeAllEmojisExcept(String, Collection\u003cEmoji\u003e)`: removes all the emojis from the String, except the ones in the Collection\n- `EmojiParser#removeEmojis(String, Collection\u003cEmoji\u003e)`: removes the emojis in the Collection from the String\n\nFor example:\n\n```java\nString str = \"An 😀awesome 😃string with a few 😉emojis!\";\nCollection\u003cEmoji\u003e collection = new ArrayList\u003cEmoji\u003e();\ncollection.add(EmojiManager.getForAlias(\"wink\")); // This is 😉\n\nSystem.out.println(EmojiParser.removeAllEmojis(str));\nSystem.out.println(EmojiParser.removeAllEmojisExcept(str, collection));\nSystem.out.println(EmojiParser.removeEmojis(str, collection));\n\n// Prints:\n// \"An awesome string with a few emojis!\"\n// \"An awesome string with a few 😉emojis!\"\n// \"An 😀awesome 😃string with a few emojis!\"\n```\n\n#### Extract Emojis from a string\n\nYou can search a string of mixed emoji/non-emoji characters and have all of the emoji characters returned as a Collection.\n\n- `EmojiParser#extractEmojis(String)`: returns all emojis as a Collection. This will include duplicates if emojis are present more than once.\n\n## Credits\n\n**emoji-java** originally used the data provided by the [github/gemoji project](https://github.com/github/gemoji). It is still based on it but has evolved since.\n\n## Available Emojis\n\nSee a table of the available emojis and their aliases [HERE](./EMOJIS.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdurmont%2Femoji-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdurmont%2Femoji-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdurmont%2Femoji-java/lists"}