A 32-bit Unicode character.

Literal characters may be written between single quotes:

' '
'\n'
'\{#03C0}'
'\{GREEK SMALL LETTER PI}'

Every Character has a unique Integer-valued Unicode code point.

Integer piCodePoint = '\{GREEK SMALL LETTER PI}'.integer; // #03C0
Character pi = #03C0.character; // GREEK SMALL LETTER PI

Characters are Enumerable, so character ranges may be produced using the measure() and span() operators.

value lowerLatinLetters = 'a'..'z';
value upperLatinLetters = 'A':26;

Characters have a natural order determined by their Unicode code points. So, for example, 'a'<'b', since 'a'.integer<'b'.integer.

By: Gavin
See also String

no subtypes hierarchy

Initializer
Character(Character character)
Attributes
controlSource Codeshared Boolean control

Determine if this character is an ISO control character.

digitSource Codeshared Boolean digit

Determine if this character is a numeric digit. That is, if its Unicode general category is Nd.

hashSource Codeshared actual Integer hash

The code point of the character.

Refines Object.hash
integerSource Codeshared Integer integer

The Unicode code point of the character.

letterSource Codeshared Boolean letter

Determine if this character is a letter. That is, if its Unicode general category is Lu, Ll, Lt, Lm, or Lo.

lowercaseSource Codeshared Boolean lowercase

Determine if this is a lowercase representation of the character. That is, if its Unicode general category is Ll.

lowercasedSource Codeshared Character lowercased

The lowercase representation of this character, in the system default locale.

predecessorSource Codeshared actual Character predecessor

The character with the unicode code point that is one greater than this character.

Throws
Refines Enumerable.predecessor ultimately refines Ordinal.predecessor
stringSource Codeshared actual String string

A string containing just this character.

successorSource Codeshared actual Character successor

The character with the unicode code point that is one less than this character.

Throws
Refines Enumerable.successor ultimately refines Ordinal.successor
titlecaseSource Codeshared Boolean titlecase

Determine if this is a title case representation of the character. That is, if its Unicode general category is Lt.

titlecasedSource Codeshared Character titlecased

The title case representation of this character.

uppercaseSource Codeshared Boolean uppercase

Determine if this is an uppercase representation of the character. That is, if its Unicode general category is Lu.

uppercasedSource Codeshared Character uppercased

The uppercase representation of this character, in the system default locale.

whitespaceSource Codeshared Boolean whitespace

Determine if this character is a whitespace character. The following characters are whitespace characters:

  • LINE FEED, \n or \{#000A},
  • FORM FEED, \f or \{#000C},
  • CARRIAGE RETURN, \r or \{#000D},
  • HORIZONTAL TABULATION, \t or \{#0009},
  • VERTICAL TABULATION, \{#000B},
  • FILE SEPARATOR, \{#001C},
  • GROUP SEPARATOR, \{#001D},
  • RECORD SEPARATOR, \{#001E},
  • UNIT SEPARATOR, \{#001F}, and
  • any Unicode character in the general category Zs, Zl, or Zp that is not a non-breaking space.
Inherited Attributes
Attributes inherited from: Ordinal<Other>
Methods
compareSource Codeshared actual Comparison compare(Character other)

Compare this character with the given string character, according to the Unicode code points of the characters.

equalsSource Codeshared actual Boolean equals(Object that)

Determines if the given object is a character with the same code point as this character.

largerThanSource Codeshared actual Boolean largerThan(Character other)

Determines if this value is strictly larger than the given value.

neighbourSource Codeshared actual Character neighbour(Integer offset)

The indirect successor or predecessor at the given offset, where:

  • x.neighbour(0) == x,
  • x.neighbour(i+1) == x.neighbour(i).successor, and
  • x.neighbour(i-1) == x.neighbour(i).predecessor.
notLargerThanSource Codeshared actual Boolean notLargerThan(Character other)

Determines if this value is smaller than or equal to the given value.

notSmallerThanSource Codeshared actual Boolean notSmallerThan(Character other)

Determines if this value is larger than or equal to the given value.

offsetSource Codeshared actual Integer offset(Character other)

Compute the offset from the given value, where:

  • x.offset(x) == 0, and
  • x.successor.offset(x) == 1 if x!=x.successor.
offsetSignSource Codeshared actual Integer offsetSign(Character other)

The sign of the offset from the given value.

smallerThanSource Codeshared actual Boolean smallerThan(Character other)

Determines if this value is strictly smaller than the given value.

Inherited Methods
Methods inherited from: Comparable<Other>
Methods inherited from: Enumerable<Other>