Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func isPalindrome(s string) bool {
- f:= func(r rune) rune {
- if !unicode.IsLetter(r) && !unicode.IsNumber(r) {
- return -1
- }
- return unicode.ToLower(r)
- }
- s = strings.Map(f,s)
- i,j:= 0, len(s) -1
- for i<j {
- if s[i] !=s[j] {
- return false
- }
- i++
- j--
- }
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement