Skip to content

Instantly share code, notes, and snippets.

@vikmeup
Created May 4, 2016 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vikmeup/d41dc8fbd4ba089f87ac2126cb4246ca to your computer and use it in GitHub Desktop.
Save vikmeup/d41dc8fbd4ba089f87ac2126cb4246ca to your computer and use it in GitHub Desktop.
func isPalindrome(s: String) -> Bool {
let cleanString = s.componentsSeparatedByCharactersInSet(NSCharacterSet.alphanumericCharacterSet().invertedSet).joinWithSeparator("")
return Bool(String(cleanString.characters).lowercaseString == String(cleanString.characters.reverse()).lowercaseString)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment