public static boolean isPalindrome(String inputString) {
        StringBuilder sb = new StringBuilder();
        for (Character c: inputString.toCharArray()) {
          if (Character.isLetter(c)) {
            sb.append(c);
          }
        }
        String forward = sb.toString().toLowerCase();
        String backward = sb.reverse().toString().toLowerCase();
        return forward.equals(backward);
      }

      Java language logo
      Palindrome

      string
      palindrome
      Java Public Recipes

      Check if a string is a palindrome

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.