RosettaCodeData/Task/Palindrome-detection/Nim/palindrome-detection.nim
2018-08-17 15:15:24 +01:00

9 lines
191 B
Nim

proc reverse(s: string): string =
result = newString(s.len)
for i,c in s:
result[s.high - i] = c
proc isPalindrome(s: string): bool =
s == reverse(s)
echo isPalindrome("FoobooF")