Shard Detail

unicode_blocr v0.2.0

Identify the Unicode block to which a character belongs

Install & Use

Add the following code to your project's shard.yml under:

dependencies to use in production
- OR -
development_dependencies to use in development

  github: j8r/unicode_blocr


Unicode Blocr

Build Status ISC

Identify the Unicode block to which a character belongs.

This library can be used to identify the type of characters, and eventually filter them (for example emoticons).

In Unicode, a block is defined as one contiguous range of code points (


Add the dependency to your shard.yml:

    github: j8r/unicode_blocr

Usage examples


To print the block range to which the character belongs:

require "unicode_blocr"

puts 'a' #=> UnicodeBlock::BasicLatin
puts 'é' #=> UnicodeBlock::Latin1Supplement

Filter characters

To keep all characters inferior to a block range, here MiscellaneousSymbolsandPictographs and Emoticons, we delete all characters belonging to blocks above MiscellaneousSymbolsandPictographs.

require "unicode_blocr"

puts "hi😊".delete &.ord.>= UnicodeBlock::EnclosedIdeographicSupplement.value #=> hi
puts "café".delete &.ord.>= UnicodeBlock::BasicLatin.value #=> caf


Copyright (c) 2018-2019 Julien Reichardt - ISC License