isPalindrome property
bool
isPalindrome
Checks whether the String
is a palindrome.
Example
String foo = 'Hello World';
bool isPalindrome = foo.isPalindrome; // returns false;
String foo = 'racecar';
bool isPalindrome = foo.isPalindrome; // returns true;
Implementation
bool get isPalindrome {
if (this.isBlank) {
return false;
}
return this == this.reverse;
}