code: public static boolean hasValidCppCharacters(String s) {
      for (char c : s.toCharArray()) {
        if (!isValidCppCharacter(c)) {
          return false;
        }
      }
      return true;
    }
docs: Returns true if all characters in a string can be expressed as either
  C++ universal characters or valid hexadecimal escape sequences.