Module unicode::charExperimental [-]  [+] [src]

Character manipulation (char type, Unicode Scalar Value)

This module provides the Char and UnicodeChar traits, as well as their implementation for the primitive char type, in order to allow basic character manipulation.

A char actually represents a Unicode Scalar Value, as it can contain any Unicode code point except high-surrogate and low-surrogate code points.

As such, only values in the ranges [0x0,0xD7FF] and [0xE000,0x10FFFF] (inclusive) are allowed. A char can always be safely cast to a u32; however the converse is not always true due to the above range limits and, as such, should be performed via the from_u32 function..

Constants

MAX

The highest valid code point

UNICODE_VERSION

The version of Unicode that the UnicodeChar and UnicodeStrPrelude traits are based on.

Traits

Char

Basic char manipulations.

UnicodeChar

Useful functions for Unicode characters.

Functions

canonical_combining_class
compose
decompose_canonical

Compute canonical Unicode decomposition for character

decompose_compatible

Compute canonical or compatible Unicode decomposition for character

escape_default

Deprecated, call the escape_default method instead.

escape_unicode

Deprecated, call the escape_unicode method instead.

from_digit

Converts a number to the character representing it

from_u32

Converts from u32 to a char

is_XID_continue

Returns whether the specified char satisfies the 'XID_Continue' Unicode property

is_XID_start

Returns whether the specified char satisfies the 'XID_Start' Unicode property

is_alphabetic

Returns whether the specified char is considered a Unicode alphabetic code point

is_alphanumeric

Indicates whether a char is alphanumeric

is_control

Indicates whether a char is a control code point

is_digit

Indicates whether the char is numeric (Nd, Nl, or No)

is_digit_radix

Checks if a char parses as a numeric digit in the given radix

is_lowercase

Indicates whether a char is in lower case

is_uppercase

Indicates whether a char is in upper case

is_whitespace

Indicates whether a char is whitespace

len_utf8_bytes

Returns the amount of bytes this char would need if encoded in UTF-8

to_digit

Converts a char to the corresponding digit

to_lowercase

Convert a char to its lowercase equivalent

to_uppercase

Convert a char to its uppercase equivalent

width

Returns this character's displayed width in columns, or None if it is a control character other than '\x00'.