Created
January 4, 2018 17:28
-
-
Save chriswebb09/90327141ea6b07a999c5caddbae088be to your computer and use it in GitHub Desktop.
This file contains 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 palindrome(string: String) -> Bool { | |
var replacedString = string.replacingOccurrences(of: " ", with: "") | |
replacedString = replacedString.components(separatedBy:.punctuationCharacters).joined() | |
return replacedString.lowercased() == String(replacedString.lowercased().reversed()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment