Ad
Regular Expressions
Declarative Programming
Advanced Language Features
Programming Paradigms
Fundamentals
Strings

You could also just test your strings length.

Code
Diff
  • class StringParity {
      public static boolean isEvenLength(String str) {
        return str.length() % 2 == 0;
      }
    }
    • class StringParity {
    • public static boolean isEvenLength(String str) {
    • return str.replaceAll("(?s)..", "").isEmpty(); // (?s) enables DOTALL
    • return str.length() % 2 == 0;
    • }
    • }