1 public static boolean checkFormat(String sentence){ 2 return sentence.matches("^[A-Z].+\\.$"); 3 }
1 public static void test(){ 2 String knights = 3 "Then, when you have found the shrubbery," 4 + "you must cut down the mightiest tree in the forest... " 5 + "with... a herring"; 6 String newString = Arrays.toString(knights.split(" ")); 7 System.out.println(newString); 8 }
1 public static void test(){ 2 String knights = 3 "Then, when you have found the shrubbery," 4 + "you must cut down the mightiest tree in the forest... " 5 + "with... a herring"; 6 String newKnights = knights.replaceAll("[AaEeIiOoUu]", "_"); 7 System.out.println(newKnights); 8 }