Palindrome

    0

    3

    stringpalindrome
    Java Public Recipes

    Check if a string is a palindrome

    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);
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.