An open API service indexing awesome lists of open source software.

https://github.com/janlelis/unicode-types

Basic Unicode Types of a Ruby String
https://github.com/janlelis/unicode-types

ruby types unicode unicode-data

Last synced: about 1 year ago
JSON representation

Basic Unicode Types of a Ruby String

Awesome Lists containing this project

README

          

# Unicode::Types [![[version]](https://badge.fury.io/rb/unicode-types.svg)](https://badge.fury.io/rb/unicode-types) [![[ci]](https://github.com/janlelis/unicode-types/workflows/Test/badge.svg)](https://github.com/janlelis/unicode-types/actions?query=workflow%3ATest)

Determine the basic type of codepoints. This can be one of:

- Graphic
- Format
- Control
- Private-use
- Surrogate
- Noncharacter
- Reserved

Unicode version: **16.0.0** (September 2024)

## Gemfile

```ruby
gem "unicode-types"
```

## Usage

```ruby
require "unicode/types"

# All general types of a string
Unicode::Types.types("A\tb") # => ["Control", "Graphic"]

# Also aliased as .of
Unicode::Types.of("\u{FFFFF}") # => ["Noncharacter"]

# Single codepoint
Unicode::Types.type("\u{FFFFD}") # => "Reserved"
```

The list of types is always sorted alphabetically.

See [unicode-x](https://github.com/janlelis/unicode-x) for more Unicode related micro libraries.

## MIT License

- Copyright (C) 2016-2024 Jan Lelis . Released under the MIT license.
- Unicode data: http://www.unicode.org/copyright.html#Exhibit1