Class Palindrome

java.lang.Object
  extended by Palindrome

public class Palindrome
extends java.lang.Object


Constructor Summary
Palindrome()
           
 
Method Summary
static boolean isPalindrome(java.lang.String x)
          Tests whether its input is or is not a palindrome; the test is case-insenstive, and white space and any characters that are not letters are ignored, such as digits and punctuation marks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Palindrome

public Palindrome()
Method Detail

isPalindrome

public static boolean isPalindrome(java.lang.String x)
Tests whether its input is or is not a palindrome; the test is case-insenstive, and white space and any characters that are not letters are ignored, such as digits and punctuation marks. For example, "Red rum, sir, is murder!" counts as a palindrome.

Parameters:
x - The string to test
Returns:
true if x is a palindrome, false if it is not. Here is a list of some examples, in a format suitable for cutting and pasting into your testing code. I took these examples from the Wikipedia article.
  static char *examples[] =
  { "racecar",
  "RACEcar", // uppercase equals lowercase
  "rotator",
  "rotor",
  "civic",
  "Red rum, sir, is murder!", // punctuation and spaces are neglected
  "Rats live on no evil star.",
  "Neil, a trap! Sid is part alien!",
  "Step on no pets.",
  "Dammit, Iím mad!",
  "Madam, Iím Adam.",
  "Madam, in Eden, Iím Adam.",
  "Rise to vote, sir.",
  "Never odd or even",
  "If I had a hi-fi",
  "Yo, banana boy!",
  "Do geese see God?",
  "No devil lived on.",
  "Ah, Satan sees Natasha.",
  "A dog, a panic in a pagoda",
  "Was it a cat I saw?",
  "Was it a car or a cat I saw?",
  "No lemons, no melon",
  "A dog, a plan, a canal, pagoda",
  "A man, a plan, a canal-- Panama!"
  };