RosettaCodeData/Task/Palindrome-detection/LiveCode/palindrome-detection.livecode

17 lines
425 B
Plaintext

function palindrome txt exact
if exact is empty or exact is not false then
set caseSensitive to true --default is false
else
replace space with empty in txt
put lower(txt) into txt
end if
return txt is reverse(txt)
end palindrome
function reverse str
repeat with i = the length of str down to 1
put byte i of str after revstr
end repeat
return revstr
end reverse