List of usage examples for java.util Scanner delimiter
public Pattern delimiter()
From source file:MainClass.java
public static void main(String args[]) throws IOException { Scanner src = new Scanner("1,2,3,4"); src.useDelimiter(", *"); System.out.println(src.delimiter()); }
From source file:Main.java
public static void main(String[] args) { String s = "java2s.com 1 + 1 = 2.0"; Scanner scanner = new Scanner(s); // print the next line of the string System.out.println(scanner.nextLine()); // print the delimiter this scanner is using System.out.println(scanner.delimiter()); scanner.close();// w w w. j a va2s . com }
From source file:Main.java
public static void main(String[] args) { String s = "java2s.com 1 + 1 = 2.0 true "; Scanner scanner = new Scanner(s); System.out.println(scanner.nextLine()); // change the delimiter of this scanner scanner.useDelimiter("Wor"); // display the new delimiter System.out.println(scanner.delimiter()); scanner.close();/*from www.j av a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { String s = "java2s.com 1 + 1 = 2.0 true "; Scanner scanner = new Scanner(s); System.out.println(scanner.nextLine()); // change the delimiter of this scanner scanner.useDelimiter(Pattern.compile(".ll.")); // display the new delimiter System.out.println(scanner.delimiter()); scanner.close();//from w w w . j ava 2 s . c om }