Created
May 4, 2016 22:28
-
-
Save vikmeup/d41dc8fbd4ba089f87ac2126cb4246ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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