RosettaCodeData/Task/Palindrome-detection/Swift/palindrome-detection-2.swift
2016-12-05 23:44:36 +01:00

5 lines
158 B
Swift

func isPal(str: String) -> Bool {
let c = str.characters
return lazy(c).reverse()
.startsWith(c[c.startIndex...advance(c.startIndex, c.count / 2)])
}