June 2007
Intermediate to advanced
294 pages
8h 6m
English
I’m rounding out this chapter with a few shorter examples pertaining to palindromes, which are bits of text that are the same when reversed as they are when read normally. Usually, we allow cheating to ignore spaces, capitalization differences, and punctuation, so A man, a plan, a canal, Panama qualifies as a palindrome under those conditions. While working on this book, I was reading another programming book that contained a discussion about palindromes. “Great!” I thought. “I’ll add a palindrome? predicate method to all Strings. It’ll be a nice simple bit to have in the chapter in which I talk about text.” So I started thinking about breaking Strings into individual characters, writing a method ...
Read now
Unlock full access