JAVA LAnguage
public class Exercise10_25 {
public static void main(String[] args) { // Do not make any changes to this method
String[][] testStrings = {
{"ab#12#453", "#"},
{"a,b,gf,e", ","},
{"789-56-20-31-16", "-"},
{"789-56-20-31-16", ","}
};
System.out.println("Test String Delimiter Result");
System.out.println("----------- --------- ---------------");
for(int i = 0; i < testStrings.length; i++) {
String testString = testStrings[i][0];
String delim = testStrings[i][1];
System.out.printf("%-25s%-13s", testString, delim);
String[] result = split(testString, delim);
for(int j = 0; j < result.length; j++)
System.out.print(result[j] + " ");
System.out.println();
}
}
public static String[] split(String s, String delimiter) {
String[] result = s.split(delimiter); // Comment out this line and replace it with your own code
return result;
}
}