isPalindrome static method

bool isPalindrome(
  1. String s
)

Checks if the given string s is a palindrome Example : aha => true hello => false

Implementation

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