Squeak Class Documentation category index | class index  
 
Character
  category: Collections-Text
  superclass: Magnitude
  subclasses:

I represent a character by storing its associated ASCII code (extended to 256 codes). My instances are created uniquely, so that all instances of a character ($R, for example) are identical.

instance methods
  accessing
  asciiValue
digitValue

  comparing
  <
=
>
hash

  converting
  asCharacter
asIRCLowercase
asInteger
asLowercase
asString
asSymbol
asText
asUppercase
isoToSqueak
squeakToIso
to:

  copying
  clone
copy
deepCopy
veryDeepCopyWith:

  object fileIn
  comeFullyUpOnReload:
objectForDataStream:

  printing
  hex
isLiteral
printOn:
printOnStream:
storeOn:

  testing
  isAlphaNumeric
isDigit
isLetter
isLowercase
isSafeForHTTP
isSeparator
isSpecial
isUppercase
isVowel
tokenish

class methods
  accessing untypeable characters
  arrowDown
arrowLeft
arrowRight
arrowUp
backspace
cr
delete
end
enter
escape
euro
home
insert
lf
linefeed
nbsp
newPage
pageDown
pageUp
space
tab

  class initialization
  initialize

  constants
  alphabet
characterTable

  instance creation
  allCharacters
digitValue:
new
separators
value:

instance methods
  accessing top  
 

asciiValue

Answer the value of the receiver that represents its ascii encoding.


 

digitValue

Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0
otherwise. This is used to parse literal numbers of radix 2-36.


  comparing top  
 

<

Answer true if the receiver's value < aCharacter's value.


 

=

Primitive. Answer true if the receiver and the argument are the same
object (have the same object pointer) and false otherwise. Optional. See
Object documentation whatIsAPrimitive.


 

>

Answer true if the receiver's value > aCharacter's value.


 

hash

Hash is reimplemented because = is implemented.


  converting top  
 

asCharacter

Answer the receiver itself.


 

asIRCLowercase

convert to lowercase, using IRC's rules


 

asInteger

Answer the value of the receiver.


 

asLowercase

If the receiver is uppercase, answer its matching lowercase Character.


 

asString

Answer a string that represents the receiver.


 

asSymbol

Answer a Symbol consisting of the receiver as the only element.


 

asText


 

asUppercase

If the receiver is lowercase, answer its matching uppercase Character.


 

isoToSqueak

Convert receiver from iso8895-1 (actually CP1252) to mac encoding.
Does not do lf/cr conversion! Characters not available in MacRoman
encoding have been remapped to their base characters or to $?.


 

squeakToIso

Convert from mac to iso8895-1 encoding. Does not do lf/cr conversion!


 

to:

Answer with a collection in ascii order -- $a to: $z


  copying top  
 

clone

Answer with the receiver, because Characters are unique.


 

copy

Answer with the receiver because Characters are unique.


 

deepCopy

Answer with the receiver because Characters are unique.


 

veryDeepCopyWith:

Return self. I can't be copied.


  object fileIn top  
 

comeFullyUpOnReload:

Use existing an Character. Don't use the new copy.


 

objectForDataStream:

I am being collected for inclusion in a segment. Do not include Characters! Let them be in outPointers.


  printing top  
 

hex


 

isLiteral

Answer whether the receiver has a literal text form recognized by the
compiler.


 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


 

printOnStream:


 

storeOn:

Character literals are preceded by '$'.


  testing top  
 

isAlphaNumeric

Answer whether the receiver is a letter or a digit.


 

isDigit

Answer whether the receiver is a digit.


 

isLetter

Answer whether the receiver is a letter.


 

isLowercase

Answer whether the receiver is a lowercase letter.
(The old implementation answered whether the receiver is not an uppercase letter.)


 

isSafeForHTTP

whether a character is 'safe', or needs to be escaped when used, eg, in a URL


 

isSeparator

Answer whether the receiver is one of the separator characters--space,
cr, tab, line feed, or form feed.


 

isSpecial

Answer whether the receiver is one of the special characters


 

isUppercase

Answer whether the receiver is an uppercase letter.
(The old implementation answered whether the receiver is not a lowercase letter.)


 

isVowel

Answer whether the receiver is one of the vowels, AEIOU, in upper or
lower case.


 

tokenish

Answer whether the receiver is a valid token-character--letter, digit, or
colon.


class methods
  accessing untypeable characters top  
 

arrowDown


 

arrowLeft


 

arrowRight


 

arrowUp


 

backspace

Answer the Character representing a backspace.


 

cr

Answer the Character representing a carriage return.


 

delete


 

end


 

enter

Answer the Character representing enter.


 

escape

Answer the ASCII ESC character


 

euro

The Euro currency sign, that E with two dashes. The key code is a wild guess


 

home


 

insert


 

lf

Answer the Character representing a linefeed.


 

linefeed

Answer the Character representing a linefeed.


 

nbsp

non-breakable space.


 

newPage

Answer the Character representing a form feed.


 

pageDown


 

pageUp


 

space

Answer the Character representing a space.


 

tab

Answer the Character representing a tab.


  class initialization top  
 

initialize

Create the table of unique Characters. This code is not shown so that the
user can not destroy the system by trying to recreate the table.


  constants top  
 

alphabet

($a to: $z) as: String


 

characterTable

Answer the class variable in which unique Characters are stored.


  instance creation top  
 

allCharacters


 

digitValue:

Answer the Character whose digit value is x. For example, answer $9 for
x=9, $0 for x=0, $A for x=10, $Z for x=35.


 

new

Creating new characters is not allowed.


 

separators

space


 

value:

Answer the Character whose value is anInteger.