Otera.Unicode (otera v0.1.0)

Copy Markdown View Source

The character properties of Python str methods, such as isprintable(), isdigit() and the cased letters of title().

The properties come from priv/unicode_properties.json, which scripts/generate_unicode_properties.py writes from the predicates of the pinned Python, so Otera uses the Unicode version of the Python reference and not the one of Erlang/OTP. Each property is a sorted tuple of code point ranges, and a lookup is a binary search.

Summary

Functions

Returns true for a letter, like str.isalpha().

Returns true for a cased character: a lowercase, uppercase or titlecase letter.

Returns true for a decimal digit, like str.isdecimal().

Returns true for a digit, like str.isdigit().

Returns true for a character with the Lowercase property, like str.islower() of one character.

Returns true for a numeric character, like str.isnumeric().

Returns true if Python repr() prints char as it is, like str.isprintable().

Returns true for whitespace, like str.isspace().

Returns true for a character with the Uppercase property, like str.isupper() of one character.

Functions

alpha?(char)

@spec alpha?(char()) :: boolean()

Returns true for a letter, like str.isalpha().

cased?(char)

@spec cased?(char()) :: boolean()

Returns true for a cased character: a lowercase, uppercase or titlecase letter.

decimal?(char)

@spec decimal?(char()) :: boolean()

Returns true for a decimal digit, like str.isdecimal().

digit?(char)

@spec digit?(char()) :: boolean()

Returns true for a digit, like str.isdigit().

lowercase?(char)

@spec lowercase?(char()) :: boolean()

Returns true for a character with the Lowercase property, like str.islower() of one character.

numeric?(char)

@spec numeric?(char()) :: boolean()

Returns true for a numeric character, like str.isnumeric().

printable?(char)

@spec printable?(char()) :: boolean()

Returns true if Python repr() prints char as it is, like str.isprintable().

space?(char)

@spec space?(char()) :: boolean()

Returns true for whitespace, like str.isspace().

uppercase?(char)

@spec uppercase?(char()) :: boolean()

Returns true for a character with the Uppercase property, like str.isupper() of one character.