View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Fall2002 Midterm Review: Palindromes

findPalindromes: aCollection

aNewCollection aSecondString anActualString

aNewCollection := Collection new.

aCollection do: [ :aSingleString |
anActualString := aSingleString.
aSingleString := aSingleString reject: [:ch | ch = Character space].
aSecondString := aSingleString reverse.
(aSecondString = aSingleString) ifTrue: [ aNewCollection add: anActualString.].


Link to this Page