isPalindrome static method

bool isPalindrome(
  1. String s
)

Checks if string is Palindrome. 检查字符串是否为回文

Implementation

static bool isPalindrome(String s) {
  bool isPalindrome = true;
  for (var i = 0; i < s.length; i++) {
    if (s[i] != s[s.length - i - 1]) {
      isPalindrome = false;
    }
  }
  return isPalindrome;
}