7 lines
223 B
Text
7 lines
223 B
Text
/* Palindrome detection, in Jsish */
|
|
function isPalindrome(str:string, exact:boolean=true) {
|
|
if (!exact) {
|
|
str = str.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
}
|
|
return str === str.split('').reverse().join('');
|
|
}
|