29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

aCharacter isAlphabetic.<br />

aCharacter isDigit.<br />

aCharacter isLetter.<br />

aCharacter isLowercase.<br />

aCharacter isVowel.<br />

It also provides some useful conversion methods, including:<br />

aCharacter asUppercase.<br />

aCharacter asLowercase.<br />

aCharacter asInteger.<br />

The first two messages would convert the contents of aCharacter either to <strong>an</strong> uppercase character or<br />

a lowercase character while the third message would return the ASCII code a letter or number.<br />

Just like the classes Date <strong><strong>an</strong>d</strong> Time, the Character class provides some useful class side<br />

protocol. The methods provided on the class side provide access to non -alph<strong>an</strong>umeric characters. These<br />

c<strong>an</strong> be extremely useful w hen processing text (as was illustrated in the example presented earlier in the<br />

book). The facilities available allow you to obtain the character for carriage return, backspace, space,<br />

new page <strong><strong>an</strong>d</strong> tab (amongst others). For example:<br />

newlineChar := Character cr.<br />

spaceChar := Character space.<br />

tabChar := Character tab.<br />

14.6 Further reading<br />

The <strong>Object</strong> Reference m<strong>an</strong>ual supplied with your <strong>Smalltalk</strong> system will provide a detailed description<br />

of all the classes described in this chapter. For a detailed description of t he Number hierarchy see<br />

[Hopkins <strong><strong>an</strong>d</strong> Hor<strong>an</strong> 1995].<br />

121

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!