E's chars are standard 16-bit unicode characters. Character literals are written just as in Java, a single quote, a character specifier (***what's the name for this***) and a closing single quote. The character specifier can be a single non-special character, or a backslash followed by an escape sequence. ? pragma.syntax("0.8") ? 'a'.asInteger() # value: 97 ? '\n'.asInteger() # value: 10 Here are the char operators in precedence order: Boolean Comparisons (non-associative)
As you'd expect. Magnitude Comparisons (non-associative)
If you ask the chars to compare themselves, they compare according to their unicode character codes. For locale-specific sorting orders, see ***. Additive Expressions (left associative)
You can add a char and an integer to get a new char whose character code differs by that amount. You can subtract two chars to get the distance between their character codes.
Additional char MessagesIn addition to the messages corresponding to the above operators, chars respond to the following messages. ? 'a'.asInteger() # value: 97 For additional messages, see the javadoc-umentation for java.lang.Character. Many of the static methods found there will be turned into instance methods on chars, but this hasn't happened yet.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
|