Palindrome detection: Difference between revisions

Picat: forgot the strip/1 function.
(Picat: forgot the strip/1 function.)
Line 3,919:
is_palindrome_inexact(N), number(N) => is_palindrome_inexact(N.to_string()).
is_palindrome_inexact(S) =>
is_palindrome(strip(S)).</lang>
 
 
% convert to lowercase and
% skips punctuation and white space.
strip(S) = [C : C in S.to_lowercase(),
not C.membchk("!?,.;-_ \t\n()[]{}")].</lang>
 
{{out}}
495

edits