Back: CFunctionDescriptor-printing
Up: Class reference
Forward: Character class-built ins
 
Top: GNU Smalltalk User's Guide
Contents: Table of Contents
Index: Class index
About: About this document

6.25 Character

Defined in namespace Smalltalk
Category: Language-Data types
My instances represent the 256 characters of the character set. I provide messages to translate between integers and character objects, and provide names for some of the common unprintable characters.

6.25.1 Character class: built ins  (class)
6.25.2 Character class: constants  (class)
6.25.3 Character class: initializing lookup tables  (class)
6.25.4 Character class: Instance creation  (class)
6.25.5 Character class: testing  (class)
6.25.6 Character: built ins  (instance)
6.25.7 Character: Coercion methods  (instance)
6.25.8 Character: comparing  (instance)
6.25.9 Character: converting  (instance)
6.25.10 Character: printing  (instance)
6.25.11 Character: storing  (instance)
6.25.12 Character: testing  (instance)
6.25.13 Character: testing functionality  (instance)


6.25.1 Character class: built ins

asciiValue: anInteger
Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. #codePoint:, #asciiValue: and #value: are synonyms.

codePoint: anInteger
Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. #codePoint:, #asciiValue: and #value: are synonyms.

value: anInteger
Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. #codePoint:, #asciiValue: and #value: are synonyms.


6.25.2 Character class: constants

backspace
Returns the character 'backspace'

bell
Returns the character 'bel'

cr
Returns the character 'cr'

eof
Returns the character 'eof', also known as 'sub'

eot
Returns the character 'eot', also known as 'Ctrl-D'

esc
Returns the character 'esc'

lf
Returns the character 'lf', also known as 'nl'

newPage
Returns the character 'newPage', also known as 'ff'

nl
Returns the character 'nl', also known as 'lf'

nul
Returns the character 'nul'

space
Returns the character 'space'

tab
Returns the character 'tab'


6.25.3 Character class: initializing lookup tables

initialize
Initialize the lookup table which is used to make case and digit-to-char conversions faster. Indices in Table are ASCII values incremented by one. Indices 1-256 classify chars (0 = nothing special, 2 = separator, 48 = digit, 55 = uppercase, 3 = lowercase), indices 257-512 map to lowercase chars, indices 513-768 map to uppercase chars.


6.25.4 Character class: Instance creation

digitValue: anInteger
Returns a character that corresponds to anInteger. 0-9 map to $0-$9, 10-35 map to $A-$Z


6.25.5 Character class: testing

isIdentity
Answer whether x = y implies x == y for instances of the receiver

isImmediate
Answer whether, if x is an instance of the receiver, x copy == x


6.25.6 Character: built ins

= char
Boolean return value; true if the characters are equal

asciiValue
Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms.

asInteger
Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms.

codePoint
Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms.

value
Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms.


6.25.7 Character: Coercion methods

asLowercase
Returns self as a lowercase character if it's an uppercase letter, otherwise returns the character unchanged.

asString
Returns the character self as a string.

asSymbol
Returns the character self as a symbol.

asUppercase
Returns self as a uppercase character if it's an lowercase letter, otherwise returns the character unchanged.


6.25.8 Character: comparing

< aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the least.

<= aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the least or their equal.

> aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the greatest.

>= aCharacter
Compare the character's ASCII value. Answer whether the receiver's is the greatest or their equal.


6.25.9 Character: converting

digitValue
Returns the value of self interpreted as a digit. Here, 'digit' means either 0-9, or A-Z, which maps to 10-35.


6.25.10 Character: printing

displayOn: aStream
Print a representation of the receiver on aStream. Unlike #printOn:, this method strips the leading dollar.

printOn: aStream
Store a representation of the receiver on aStream


6.25.11 Character: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


6.25.12 Character: testing

isAlphaNumeric
True if self is a letter or a digit

isDigit
True if self is a 0-9 digit

isLetter
True if self is an upper- or lowercase letter

isLowercase
True if self is a lowercase letter

isPunctuation
Returns true if self is one of '.,:;!?'

isSeparator
Returns true if self is a space, cr, tab, nl, or newPage

isUppercase
True if self is uppercase

isVowel
Returns true if self is a, e, i, o, or u; case insensitive


6.25.13 Character: testing functionality

isCharacter
Answer True. We're definitely characters




This document was generated on May, 12 2002 using texi2html