Вот код:
import java.util.Arrays;
import java.util.List;
public class StringSplitMultipleDelimeter {
public static void main(String[] args) {
List<String> delimiters= Arrays.asList(",",".","!","?","$","&","^","%","@");
String givenString = "Test,String.with?Multiple@delimeters!example";
//Create Regex to split sting
StringBuilder regex = new StringBuilder();
regex.append("[");
delimiters.forEach(delimeter -> regex.append(delimeter));
regex.append("]");
String[] tokens = givenString.split(regex.toString());
System.out.println("Number of tokens = " + tokens.length);
for(int i =0; i<tokens.length; i++) {
System.out.println(tokens[i]);
}
}
}