Algorithms · real, tested code

Check if a String is a Palindrome in Larzscript

Detect whether a string reads the same forwards and backwards, ignoring case, spaces and punctuation.

str.is_palindrome() lowercases and strips non-alphanumeric characters before comparing - so real sentences like "A man, a plan, a canal: Panama" work, not just single words.

larzscript pkg install str

Code

import "str" as str_

print(str_.is_palindrome("A man a plan a canal Panama"))
print(str_.is_palindrome("racecar"))
print(str_.is_palindrome("Larzscript"))
Output
true
true
false