private static boolean hasChar(CharSequence s, int index, char c) {
    return index >= 0 && index < s.length() && s.charAt(index) == c;
  }
private static boolean hasChar(CharSequence s, int index, char c)