{"id":20877495,"url":"https://github.com/t1/codepoint","last_synced_at":"2026-05-18T02:33:56.607Z","repository":{"id":142921337,"uuid":"160019475","full_name":"t1/codepoint","owner":"t1","description":"CodePoint class to work easily with Unicode code points","archived":false,"fork":false,"pushed_at":"2019-10-04T13:02:54.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-05T02:38:57.407Z","etag":null,"topics":["java","kotlin","unicode"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/t1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-12-02T06:15:41.000Z","updated_at":"2019-10-04T13:02:56.000Z","dependencies_parsed_at":"2023-04-27T17:55:05.623Z","dependency_job_id":null,"html_url":"https://github.com/t1/codepoint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/t1/codepoint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t1%2Fcodepoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t1%2Fcodepoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t1%2Fcodepoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t1%2Fcodepoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t1","download_url":"https://codeload.github.com/t1/codepoint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t1%2Fcodepoint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33162642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["java","kotlin","unicode"],"created_at":"2024-11-18T06:57:12.802Z","updated_at":"2026-05-18T02:33:56.586Z","avatar_url":"https://github.com/t1.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodePoints\n\nUnicode characters require 32 bits, while Java `char`s have only 16 bit,\nso a Java `String` uses one or two `char`s for each Unicode character,\nwhere the first `char` indicates that this is not a single `char`.\nThis is called UTF-16 encoding, and it works fine when working with `String` s,\nbut when you have to work with individual characters, you'll have to use special APIs,\ne.g. to find out how many Unicode characters are in a `String`,\ninstead of `string.length()`, you'll have to call `string.codePointCount(0, string.length())`.\nThere are many of these helper methods in `Character` and `String`, but they are not convenient to use.\n\nThis project provides a class `CodePoint` that you can use instead of `Character`\nto easily work with code points.\n\n# Examples\n\nYou can construct a `CodePoint` from a `String` containing only one code point: `CodePoint GRINNING_FACE = CodePoint.of(\"😀\");`.\n\nFor convenience, you can also construct single-`char` `CodePoint`s from a `char`: `CodePoint A = CodePoint.of('A');`.\n\nSometimes you'll want to construct a `CodePoint` from an `int`: `CodePoint ARABIC_1 = CodePoint.of(0x0661);`\n\n\nYou can test some properties on a `CodePoint`, e.g. `ARABIC_1.isDigit()` is `true`.\n\nYou can test if a `CodePoint` is within a range: `A.rangeTo(Z).contains(Z)`.\n\nTo add a `CodePoint` to a `StringBuilder`, call `GRINNING_FACE.appendTo(stringBuilder)`.\n\nTo get the number of `CodePoint`s in a `String`, call `CodePoint.getCodePointCount(\"ABC😀\")` (which is 4),\nor to get a `List` of all `CodePoint`s in a `String`, call `CodePoint.allOf(\"ABC\")`.\n\n\nThere is one special `CodePoint` that is actually not a valid Unicode character:\n`EOF` is defined as a constant for `End Of File` with the value -1,\nwhich is used, e.g. by a `Reader`, to indicate the end of a file.\n\n# Dependency\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.t1\u003c/groupId\u003e\n    \u003cartifactId\u003ecodepoint\u003c/artifactId\u003e\n    \u003cclassifier\u003ejava\u003c/classifier\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# Kotlin\n\nOh, BTW, the `CodePoint` class is written in [Kotlin](https://kotlinlang.org),\nbut you shouldn't have to care when you use Java or any other JVM language.\nThe `codepoint.jar` only contains a few small classes from the Kotlin runtime library,\nnicely shaded, so you don't have to worry about any conflicts, even if you do use Kotlin.\n\nSome APIs are more convenient in Kotlin, e.g. to express a range of `CodePoint`s, call `A..Z`\nor convert a `CharRange` like this: `('A'..'C').toCodePointRange()`.\n\nJust make sure, you don't use the `java` classifier, when you bring your own Kotlin runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft1%2Fcodepoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft1%2Fcodepoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft1%2Fcodepoint/lists"}