import java.util.Scanner; public class MainClass { public static void main(String[] argv) { String scanMe = "123x2x3x4"; String delim = "x"; Scanner scanner = new Scanner(scanMe); scanner.useDelimiter(delim); while (scanner.hasNext()) System.out.println(scanner.next()); } }
123 2 3 4