[src]

Module std::char

Character manipulation (char type, Unicode Scalar Value)

This module provides the Char trait, as well as its 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..

pub static MAX: char = '\U0010ffff'

The highest valid code point

 
Char

Useful functions for Unicode characters.

decompose_canonical

Returns the canonical decomposition of a character

decompose_compatible

Returns the compatibility decomposition of a character

escape_default

Returns a 'default' ASCII and C++11-like literal escape of a char

escape_unicode

Returns the hexadecimal Unicode escape of a char

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