isPalindrome static method
Checks if string is Palindrome.
Implementation
static bool isPalindrome(String string) {
final cleanString = string
.toLowerCase()
.replaceAll(RegExp(r"\s+"), '')
.replaceAll(RegExp(r"[^0-9a-zA-Z]+"), "");
for (var i = 0; i < cleanString.length; i++) {
if (cleanString[i] != cleanString[cleanString.length - i - 1]) {
return false;
}
}
return true;
}