struct Char

Overview

A Char represents a Unicode code point. It occupies 32 bits.

It is created by enclosing an UTF-8 character in single quotes.

'a'
'z'
'0'
'_'
'あ'

You can use a backslash to denote some characters:

'\'' # single quote
'\\' # backslash
'\e' # escape
'\f' # form feed
'\n' # newline
'\r' # carriage return
'\t' # tab
'\v' # vertical tab

You can use a backslash followed by an u and four hexadecimal characters to denote a unicode codepoint written:

'\u0041' # == 'A'

Or you can use curly braces and specify up to four hexadecimal numbers:

'\u{41}' # == 'A'

See Char literals in the language reference.

Included Modules

Defined in:

objects.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

to_xml(io : IO, *, indent : XMLT::IndentOptions = nil) : Nil
to_xml(*, indent : XMLT::IndentOptions = nil) : String
to_xml

Class methods inherited from class Object

from_xml(xml : String)
from_xml(node : XML::Node)
from_xml(xml : String, *, root : String)
from_xml(node : XML::Node, *, root : String)
from_xml

Class Method Detail

def self.from_xml(xml : String) #

[View source]
def self.from_xml(node : XML::Node) #

[View source]

Instance Method Detail

def to_xml(xml : XML::Builder) : Nil #

[View source]
def to_xml(io : IO, *, key : String | Nil = nil, indent : XMLT::IndentOptions = nil) : Nil #

[View source]
def to_xml(*, key : String | Nil = nil, indent : XMLT::IndentOptions = nil) : String #

[View source]