Native characters.

Characters are denoted with simple quote. eg. 'a' or '\n'.

Introduced properties

fun +(i: Int): Char

core :: Char :: +

The i-th char after self (in code point)
fun -(i: Int): Char

core :: Char :: -

The i-th char before self (in code point)
fun bytes: SequenceRead[Int]

core :: Char :: bytes

Returns a sequence with the UTF-8 bytes of self
intern fun code_point: Int

core :: Char :: code_point

The unicode code point value of self
fun escape_to_utf16: String

core :: Char :: escape_to_utf16

Returns self escaped to UTF-16
fun from_hex: Int

core :: Char :: from_hex

Returns self to its int value
fun is_alpha: Bool

core :: Char :: is_alpha

Returns true if the char is an alpha digit
fun is_alphanumeric: Bool

core :: Char :: is_alphanumeric

Returns true if the char is an alpha or a numeric digit
fun is_ascii: Bool

core :: Char :: is_ascii

Is self an ASCII character ?
fun is_base64_char: Bool

core :: Char :: is_base64_char

Is self a valid Base64 character ?
fun is_digit: Bool

core :: Char :: is_digit

Is self a digit? (from '0' to '9')
fun is_hexdigit: Bool

core :: Char :: is_hexdigit

Is self an hexadecimal digit ?
fun is_hi_surrogate: Bool

core :: Char :: is_hi_surrogate

Is self a UTF-16 high surrogate ?
fun is_letter: Bool

core :: Char :: is_letter

Is self a letter? (from 'A' to 'Z' and 'a' to 'z')
fun is_lo_surrogate: Bool

core :: Char :: is_lo_surrogate

Is self a UTF-16 low surrogate ?
fun is_lower: Bool

core :: Char :: is_lower

Is self a lower case letter? (from 'a' to 'z')
fun is_numeric: Bool

core :: Char :: is_numeric

Returns true if the char is a numerical digit
fun is_surrogate: Bool

core :: Char :: is_surrogate

Is self an UTF-16 surrogate pair ?
fun is_upper: Bool

core :: Char :: is_upper

Is self a upper case letter? (from 'A' to 'Z')
fun is_whitespace: Bool

core :: Char :: is_whitespace

Is self a whitespace character?
fun rot(x: Int): Char

core :: Char :: rot

Rotates self of x
fun to_i: Int

core :: Char :: to_i

If self is a digit then return this digit else return -1.
fun to_lower: Char

core :: Char :: to_lower

Return the lower case version of self.
fun to_upper: Char

core :: Char :: to_upper

Return the upper case version of self.
fun u8char_len: Int

core :: Char :: u8char_len

Length of self in a UTF-8 String

Redefined properties

redef intern fun !=(o: nullable Object): Bool

core $ Char :: !=

Have self and other different values?
redef intern fun <(i: OTHER): Bool

core $ Char :: <

Is self lesser than other?
redef intern fun <=(i: OTHER): Bool

core $ Char :: <=

not other < self
redef intern fun ==(o: nullable Object): Bool

core $ Char :: ==

Have self and other the same value?
redef intern fun >(i: OTHER): Bool

core $ Char :: >

other < self
redef intern fun >=(i: OTHER): Bool

core $ Char :: >=

not self < other
redef type OTHER: Char

core $ Char :: OTHER

What self can be compared to?
redef type SELF: Char

core $ Char :: SELF

Type of this instance, automatically specialized in every class
redef fun accept_json_serializer(v: JsonSerializer)

json :: serialization_write $ Char :: accept_json_serializer

Refinable service to customize the serialization of this class to JSON
redef fun accept_msgpack_serializer(v: MsgPackSerializer)

msgpack :: serialization_write $ Char :: accept_msgpack_serializer

Hook to customize the serialization of this class to MessagePack
redef fun add_to_bundle(bundle: NativeBundle, key: JavaString)

android :: bundle $ Char :: add_to_bundle

Called by []= to dynamically choose the appropriate method according
redef fun distance(c: OTHER): Int

core $ Char :: distance

The distance between self and d.
redef fun hash: Int

core $ Char :: hash

The hash code of the object.
redef intern fun object_id: Int

core $ Char :: object_id

An internal hash code for the object based on its identity.
redef fun output

core $ Char :: output

Display self on stdout (debug only).
redef intern fun predecessor(i: Int): OTHER

core $ Char :: predecessor

The previous element.
redef fun search_in(s: Text, from: Int): nullable Match

core :: string_search $ Char :: search_in

Search self into s from a certain position.
redef fun search_index_in(s: Text, from: Int): Int

core :: string_search $ Char :: search_index_in

Search self into s from a certain position.
redef intern fun successor(i: Int): OTHER

core $ Char :: successor

The next element.
redef fun to_s: String

core :: abstract_text $ Char :: to_s

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun +(i: Int): Char

core :: Char :: +

The i-th char after self (in code point)
fun -(i: Int): Char

core :: Char :: -

The i-th char before self (in code point)
abstract fun <(other: OTHER): Bool

core :: Comparable :: <

Is self lesser than other?
fun <=(other: OTHER): Bool

core :: Comparable :: <=

not other < self
fun <=>(other: OTHER): Int

core :: Comparable :: <=>

-1 if <, +1 if > and 0 otherwise
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
fun >(other: OTHER): Bool

core :: Comparable :: >

other < self
fun >=(other: OTHER): Bool

core :: Comparable :: >=

not self < other
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type OTHER: Comparable

core :: Comparable :: OTHER

What self can be compared to?
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
protected fun accept_json_serializer(v: JsonSerializer)

serialization :: Serializable :: accept_json_serializer

Refinable service to customize the serialization of this class to JSON
protected fun accept_msgpack_attribute_counter(v: AttributeCounter)

serialization :: Serializable :: accept_msgpack_attribute_counter

Hook to customize the behavior of the AttributeCounter
protected fun accept_msgpack_serializer(v: MsgPackSerializer)

serialization :: Serializable :: accept_msgpack_serializer

Hook to customize the serialization of this class to MessagePack
protected fun add_to_bundle(bundle: NativeBundle, key: JavaString)

serialization :: Serializable :: add_to_bundle

Called by []= to dynamically choose the appropriate method according
fun bytes: SequenceRead[Int]

core :: Char :: bytes

Returns a sequence with the UTF-8 bytes of self
fun clamp(min: OTHER, max: OTHER): OTHER

core :: Comparable :: clamp

Constraint self within [min..max]
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
intern fun code_point: Int

core :: Char :: code_point

The unicode code point value of self
fun core_serialize_to(serializer: Serializer)

serialization :: Serializable :: core_serialize_to

Actual serialization of self to serializer
fun distance(d: OTHER): Int

core :: Discrete :: distance

The distance between self and d.
fun escape_to_utf16: String

core :: Char :: escape_to_utf16

Returns self escaped to UTF-16
init from_deserializer(deserializer: Deserializer)

serialization :: Serializable :: from_deserializer

Create an instance of this class from the deserializer
fun from_hex: Int

core :: Char :: from_hex

Returns self to its int value
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_alpha: Bool

core :: Char :: is_alpha

Returns true if the char is an alpha digit
fun is_alphanumeric: Bool

core :: Char :: is_alphanumeric

Returns true if the char is an alpha or a numeric digit
fun is_ascii: Bool

core :: Char :: is_ascii

Is self an ASCII character ?
fun is_base64_char: Bool

core :: Char :: is_base64_char

Is self a valid Base64 character ?
fun is_between(c: OTHER, d: OTHER): Bool

core :: Comparable :: is_between

c <= self <= d
fun is_digit: Bool

core :: Char :: is_digit

Is self a digit? (from '0' to '9')
fun is_hexdigit: Bool

core :: Char :: is_hexdigit

Is self an hexadecimal digit ?
fun is_hi_surrogate: Bool

core :: Char :: is_hi_surrogate

Is self a UTF-16 high surrogate ?
protected fun is_in(s: Text): Bool

core :: Pattern :: is_in

Is self in s?
fun is_letter: Bool

core :: Char :: is_letter

Is self a letter? (from 'A' to 'Z' and 'a' to 'z')
fun is_lo_surrogate: Bool

core :: Char :: is_lo_surrogate

Is self a UTF-16 low surrogate ?
fun is_lower: Bool

core :: Char :: is_lower

Is self a lower case letter? (from 'a' to 'z')
fun is_numeric: Bool

core :: Char :: is_numeric

Returns true if the char is a numerical digit
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun is_surrogate: Bool

core :: Char :: is_surrogate

Is self an UTF-16 surrogate pair ?
fun is_upper: Bool

core :: Char :: is_upper

Is self a upper case letter? (from 'A' to 'Z')
fun is_whitespace: Bool

core :: Char :: is_whitespace

Is self a whitespace character?
fun max(other: OTHER): OTHER

core :: Comparable :: max

The maximum between self and other (prefers self if equals).
fun min(c: OTHER): OTHER

core :: Comparable :: min

The minimum between self and c (prefer self if equals)
protected fun msgpack_extra_array_items: Int

serialization :: Serializable :: msgpack_extra_array_items

Hook to request a larger than usual metadata array
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
abstract fun predecessor(i: Int): OTHER

core :: Discrete :: predecessor

The previous element.
fun rot(x: Int): Char

core :: Char :: rot

Rotates self of x
protected fun search_all_in(s: Text): Array[Match]

core :: Pattern :: search_all_in

Search all self occurrences into s.
protected abstract fun search_in(s: Text, from: Int): nullable Match

core :: Pattern :: search_in

Search self into s from a certain position.
protected abstract fun search_index_in(s: Text, from: Int): Int

core :: Pattern :: search_index_in

Search self into s from a certain position.
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun serialize_msgpack(plain: nullable Bool): Bytes

serialization :: Serializable :: serialize_msgpack

Serialize self to MessagePack bytes
fun serialize_to(serializer: Serializer)

serialization :: Serializable :: serialize_to

Serialize self to serializer
fun serialize_to_json(plain: nullable Bool, pretty: nullable Bool): String

serialization :: Serializable :: serialize_to_json

Serialize self to JSON
protected fun split_in(s: Text): Array[Match]

core :: Pattern :: split_in

Split s using self is separator.
abstract fun successor(i: Int): OTHER

core :: Discrete :: successor

The next element.
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_i: Int

core :: Char :: to_i

If self is a digit then return this digit else return -1.
fun to_json: String

serialization :: Serializable :: to_json

Serialize self to plain JSON
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_lower: Char

core :: Char :: to_lower

Return the lower case version of self.
fun to_pretty_json: String

serialization :: Serializable :: to_pretty_json

Serialize self to plain pretty JSON
fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun to_upper: Char

core :: Char :: to_upper

Return the upper case version of self.
fun u8char_len: Int

core :: Char :: u8char_len

Length of self in a UTF-8 String
package_diagram core::Char Char serialization::DirectSerializable DirectSerializable core::Char->serialization::DirectSerializable core::Discrete Discrete core::Char->core::Discrete core::Pattern Pattern core::Char->core::Pattern serialization::Serializable Serializable serialization::DirectSerializable->serialization::Serializable core::Comparable Comparable core::Discrete->core::Comparable core::Object Object core::Pattern->core::Object ...serialization::Serializable ... ...serialization::Serializable->serialization::Serializable ...core::Comparable ... ...core::Comparable->core::Comparable ...core::Object ... ...core::Object->core::Object

Ancestors

interface Comparable

core :: Comparable

The ancestor of class where objects are in a total order.
interface Object

core :: Object

The root of the class hierarchy.
interface Serializable

serialization :: Serializable

Instances of this class can be passed to Serializer::serialize

Parents

interface DirectSerializable

serialization :: DirectSerializable

Instances of this class are not delayed and instead serialized immediately
interface Discrete

core :: Discrete

Discrete total orders.
interface Pattern

core :: Pattern

Patterns are abstract string motifs (include String and Char).

Class definitions

core $ Char
# Native characters.
# Characters are denoted with simple quote.
# eg. `'a'` or `'\n'`.
universal Char
	super Discrete
	redef type OTHER: Char

	redef fun object_id is intern
	redef fun output `{
		if(self < 128){
			printf("%c", self);
		}else if(self < 2048){
			printf("%c%c", 0xC0 | ((0x7C0 & self) >> 6), 0x80 | (0x3F & self));
		}else if(self < 65536){
			printf("%c%c%c", 0xE0 | ((0xF000 & self) >> 12), 0x80 | ((0xFC0 & self) >> 6) ,0x80 | (0x3F & self));
		}else if(self < 2097152){
			printf("%c%c%c%c", 0xF0 | ((0x1C0000 & self) >> 18), 0x80 | ((0x3F000 & self) >> 12), 0x80 | ((0xFC0 & self) >> 6), 0x80 | (0x3F & self));
		}else{
			// Bad char
			printf("%c", self);
		}
	`}
	redef fun hash do return code_point
	redef fun ==(o) is intern
	redef fun !=(o) is intern

	redef fun <=(i) is intern
	redef fun <(i) is intern
	redef fun >=(i) is intern
	redef fun >(i) is intern

	redef fun successor(i) is intern
	redef fun predecessor(i) is intern

	# The `i`-th char after self (in code point)
	#
	# ~~~
	# assert 'A' + 5 == 'F'
	# ~~~
	#
	# Alias of `successor`.
	fun +(i: Int): Char do return successor(i)

	# The `i`-th char before self (in code point)
	#
	# ~~~
	# assert 'F' - 5 == 'A'
	# ~~~
	#
	# Alias of `predecessor`.
	fun -(i: Int): Char do return predecessor(i)

	redef fun distance(c)
	do
		var d = self.code_point - c.code_point
		if d >= 0 then
			return d
		else
			return -d
		end
	end

	# If `self` is a digit then return this digit else return -1.
	#
	#     assert '5'.to_i    == 5
	fun to_i: Int
	do

		if self == '-' then
			return -1
		else if is_digit then
			return self.code_point - '0'.code_point
		else
			return self.to_lower.code_point - 'a'.code_point + 10
		end
	end

	# The unicode code point value of `self`
	#
	#     assert 'A'.code_point == 65
	#     assert '\n'.code_point == 10
	#     assert '∋'.code_point == 0x220B
	fun code_point: Int is intern `{ return (long)self; `}

	# Is `self` an ASCII character ?
	#
	#     assert 'x'.is_ascii
	#     assert not 'ま'.is_ascii
	fun is_ascii: Bool do return code_point <= 127

	# Return the lower case version of self.
	# If self is not a letter, then return self
	#
	#     assert 'A'.to_lower  == 'a'
	#     assert 'a'.to_lower  == 'a'
	#     assert '$'.to_lower  == '$'
	fun to_lower: Char
	do
		if is_upper then
			return (code_point + ('a'.distance('A'))).code_point
		else
			return self
		end
	end

	# Return the upper case version of self.
	# If self is not a letter, then return self
	#
	#     assert 'a'.to_upper  == 'A'
	#     assert 'A'.to_upper  == 'A'
	#     assert '$'.to_upper  == '$'
	fun to_upper: Char
	do
		if is_lower then
			return (code_point - ('a'.distance('A'))).code_point
		else
			return self
		end
	end

	# Is self a digit? (from '0' to '9')
	#
	#     assert '0'.is_digit   == true
	#     assert '9'.is_digit   == true
	#     assert 'a'.is_digit   == false
	fun is_digit : Bool
	do
		return self >= '0' and self <= '9'
	end

	# Is self a lower case letter? (from 'a' to 'z')
	#
	#     assert 'a'.is_lower   == true
	#     assert 'z'.is_lower   == true
	#     assert 'A'.is_lower   == false
	#     assert '$'.is_lower   == false
	fun is_lower : Bool
	do
		return self >= 'a' and self <= 'z'
	end

	# Is self a upper case letter? (from 'A' to 'Z')
	#
	#     assert 'A'.is_upper   == true
	#     assert 'A'.is_upper   == true
	#     assert 'z'.is_upper   == false
	#     assert '$'.is_upper   == false
	fun is_upper : Bool
	do
		return self >= 'A' and self <= 'Z'
	end

	# Is self a letter? (from 'A' to 'Z' and 'a' to 'z')
	#
	#     assert 'A'.is_letter  == true
	#     assert 'A'.is_letter  == true
	#     assert 'z'.is_letter  == true
	#     assert '$'.is_letter  == false
	fun is_letter : Bool
	do
		return is_lower or is_upper
	end

	# Is self a whitespace character?
	#
	# These correspond to the "Other" and "Separator" groups of the Unicode.
	#
	# In the ASCII encoding, this is those <= to space (0x20) plus delete (0x7F).
	#
	#     assert 'A'.is_whitespace  == false
	#     assert ','.is_whitespace  == false
	#     assert ' '.is_whitespace  == true # space
	#     assert ' '.is_whitespace  == true # non-breaking space
	#     assert '\t'.is_whitespace == true
	fun is_whitespace: Bool
	do
		var i = code_point
		return i <= 0x20 or i == 0x7F or i == 0xA0
	end
end
lib/core/kernel.nit:888,1--1067,3

core :: abstract_text $ Char
redef class Char

	# Returns a sequence with the UTF-8 bytes of `self`
	#
	# ~~~
	# assert 'a'.bytes == [0x61]
	# assert 'ま'.bytes == [0xE3, 0x81, 0xBE]
	# ~~~
	fun bytes: SequenceRead[Int] do return to_s.bytes

	# Is `self` an UTF-16 surrogate pair ?
	fun is_surrogate: Bool do
		var cp = code_point
		return cp >= 0xD800 and cp <= 0xDFFF
	end

	# Is `self` a UTF-16 high surrogate ?
	fun is_hi_surrogate: Bool do
		var cp = code_point
		return cp >= 0xD800 and cp <= 0xDBFF
	end

	# Is `self` a UTF-16 low surrogate ?
	fun is_lo_surrogate: Bool do
		var cp = code_point
		return cp >= 0xDC00 and cp <= 0xDFFF
	end

	# Length of `self` in a UTF-8 String
	fun u8char_len: Int do
		var c = self.code_point
		if c < 0x80 then return 1
		if c <= 0x7FF then return 2
		if c <= 0xFFFF then return 3
		if c <= 0x10FFFF then return 4
		# Bad character format
		return 1
	end

	# ~~~
	# assert 'x'.to_s    == "x"
	# ~~~
	redef fun to_s do
		var ln = u8char_len
		var ns = new CString(ln + 1)
		u8char_tos(ns, ln)
		return ns.to_s_unsafe(ln, copy=false, clean=false)
	end

	# Returns `self` escaped to UTF-16
	#
	# i.e. Represents `self`.`code_point` using UTF-16 codets escaped
	# with a `\u`
	#
	# ~~~
	# assert 'A'.escape_to_utf16 == "\\u0041"
	# assert 'è'.escape_to_utf16 == "\\u00e8"
	# assert 'あ'.escape_to_utf16 == "\\u3042"
	# assert '𐏓'.escape_to_utf16 == "\\ud800\\udfd3"
	# ~~~
	fun escape_to_utf16: String do
		var cp = code_point
		var buf: Buffer
		if cp < 0xD800 or (cp >= 0xE000 and cp <= 0xFFFF) then
			buf = new Buffer.with_cap(6)
			buf.append("\\u0000")
			var hx = cp.to_hex
			var outid = 5
			for i in hx.chars.reverse_iterator do
				buf[outid] = i
				outid -= 1
			end
		else
			buf = new Buffer.with_cap(12)
			buf.append("\\u0000\\u0000")
			var lo = (((cp - 0x10000) & 0x3FF) + 0xDC00).to_hex
			var hi = ((((cp - 0x10000) & 0xFFC00) >> 10) + 0xD800).to_hex
			var out = 2
			for i in hi do
				buf[out] = i
				out += 1
			end
			out = 8
			for i in lo do
				buf[out] = i
				out += 1
			end
		end
		return buf.to_s
	end

	private fun u8char_tos(r: CString, len: Int) `{
		r[len] = '\0';
		switch(len){
			case 1:
				r[0] = self;
				break;
			case 2:
				r[0] = 0xC0 | ((self & 0x7C0) >> 6);
				r[1] = 0x80 | (self & 0x3F);
				break;
			case 3:
				r[0] = 0xE0 | ((self & 0xF000) >> 12);
				r[1] = 0x80 | ((self & 0xFC0) >> 6);
				r[2] = 0x80 | (self & 0x3F);
				break;
			case 4:
				r[0] = 0xF0 | ((self & 0x1C0000) >> 18);
				r[1] = 0x80 | ((self & 0x3F000) >> 12);
				r[2] = 0x80 | ((self & 0xFC0) >> 6);
				r[3] = 0x80 | (self & 0x3F);
				break;
		}
	`}

	# Returns true if the char is a numerical digit
	#
	# ~~~
	# assert '0'.is_numeric
	# assert '9'.is_numeric
	# assert not 'a'.is_numeric
	# assert not '?'.is_numeric
	# ~~~
	#
	# FIXME: Works on ASCII-range only
	fun is_numeric: Bool
	do
		return self >= '0' and self <= '9'
	end

	# Returns true if the char is an alpha digit
	#
	# ~~~
	# assert 'a'.is_alpha
	# assert 'Z'.is_alpha
	# assert not '0'.is_alpha
	# assert not '?'.is_alpha
	# ~~~
	#
	# FIXME: Works on ASCII-range only
	fun is_alpha: Bool
	do
		return (self >= 'a' and self <= 'z') or (self >= 'A' and self <= 'Z')
	end

	# Is `self` an hexadecimal digit ?
	#
	# ~~~
	# assert 'A'.is_hexdigit
	# assert not 'G'.is_hexdigit
	# assert 'a'.is_hexdigit
	# assert not 'g'.is_hexdigit
	# assert '5'.is_hexdigit
	# ~~~
	fun is_hexdigit: Bool do return (self >= '0' and self <= '9') or (self >= 'A' and self <= 'F') or
					(self >= 'a' and self <= 'f')

	# Returns true if the char is an alpha or a numeric digit
	#
	# ~~~
	# assert 'a'.is_alphanumeric
	# assert 'Z'.is_alphanumeric
	# assert '0'.is_alphanumeric
	# assert '9'.is_alphanumeric
	# assert not '?'.is_alphanumeric
	# ~~~
	#
	# FIXME: Works on ASCII-range only
	fun is_alphanumeric: Bool
	do
		return self.is_numeric or self.is_alpha
	end

	# Returns `self` to its int value
	#
	# REQUIRE: `is_hexdigit`
	fun from_hex: Int do
		if self >= '0' and self <= '9' then return code_point - 0x30
		if self >= 'A' and self <= 'F' then return code_point - 0x37
		if self >= 'a' and self <= 'f' then return code_point - 0x57
		# Happens if self is not a hexdigit
		assert self.is_hexdigit
		# To make flow analysis happy
		abort
	end
end
lib/core/text/abstract_text.nit:2152,1--2337,3

core :: string_search $ Char
redef class Char
	super Pattern

	redef fun search_index_in(s, from)
	do
		var stop = s.length
		while from < stop do
			if s[from] == self then return from
			from += 1
		end
		return -1
	end

	redef fun search_in(s, from)
	do
		var pos = search_index_in(s, from)
		if pos < 0 then
			return null
		else
			return new Match(s.to_s, pos, 1)
		end
	end
end
lib/core/text/string_search.nit:304,1--326,3

base64 :: base64 $ Char
redef class Char
	# Is `self` a valid Base64 character ?
	fun is_base64_char: Bool do
		if code_point >= 127 then return false
		return code_point.is_base64_char
	end
end
lib/base64/base64.nit:20,1--26,3

crypto :: basic_ciphers $ Char
redef class Char
	# Rotates self of `x`
	#
	# NOTE: works on letters only
	#
	#     assert 'x'.rot(6) == 'd'
	#     assert 'T'.rot(15) == 'I'
	#     assert '1'.rot(10) == '1'
	#     assert '$'.rot(10) == '$'
	#     assert 'z'.rot(-2) == 'x'
	fun rot(x: Int): Char do
		if not is_letter then return self
		x = x % 26
		if x < 0 then x += 26
		var up = false
		var val = code_point
		if is_upper then
			up = true
			val += 32
		end
		val += x
		if val > 122 then val -= 26
		if up then val -= 32
		return val.code_point
	end
end
lib/crypto/basic_ciphers.nit:18,1--43,3

serialization :: serialization_core $ Char
redef class Char super DirectSerializable end
lib/serialization/serialization_core.nit:259,1--45

json :: serialization_write $ Char
redef class Char
	redef fun accept_json_serializer(v)
	do
		if v.plain_json then
			to_s.accept_json_serializer v
		else
			v.stream.write "\{\"__kind\": \"char\", \"__val\": "
			to_s.accept_json_serializer v
			v.stream.write "\}"
		end
	end
end
lib/json/serialization_write.nit:276,1--287,3

serialization :: inspect $ Char
redef class Char
	redef fun accept_inspect_serializer(v)
	do
		v.stream.write "'"
		v.stream.write to_s.escape_to_nit
		v.stream.write "'"
	end
end
lib/serialization/inspect.nit:203,1--210,3

json :: static $ Char
redef class Char
	# Is `self` a valid number start ?
	private fun is_json_num_start: Bool do
		if self == '-' then return true
		if self.is_numeric then return true
		return false
	end

	# Is `self` a valid JSON separator ?
	private fun is_json_separator: Bool do
		if self == ':' then return true
		if self == ',' then return true
		if self == '{' then return true
		if self == '}' then return true
		if self == '[' then return true
		if self == ']' then return true
		if self == '"' then return true
		if self.is_whitespace then return true
		return false
	end
end
lib/json/static.nit:137,1--157,3

msgpack :: serialization_write $ Char
redef class Char
	redef fun accept_msgpack_serializer(v)
	do
		if v.plain_msgpack then
			# Write as a string
			v.stream.write_msgpack_fixstr to_s
		else
			# Write as ext
			var bytes = to_s.to_bytes
			v.stream.write_msgpack_ext(v.ext_typ_char, bytes)
		end
	end
end
lib/msgpack/serialization_write.nit:275,1--287,3

android :: bundle $ Char
redef class Char
	redef fun add_to_bundle(bundle, key)
	do
		bundle.put_char(key, self)
	end
end
lib/android/bundle/bundle.nit:693,1--698,3