Java Scanner Usage getNextInput(Scanner scan)

Here you can find the source of getNextInput(Scanner scan)

Description

read next input string

License

Apache License

Parameter

Parameter Description
scan Scanner corresponding to input

Return

next input string

Declaration

public static String getNextInput(Scanner scan) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Scanner;

public class Main {
    private final static String SEPARATOR = "#";

    /**/*www. j  a va2  s. c o m*/
     * read next input string
     * 
     * @param scan
     *            Scanner corresponding to input
     * 
     * @return next input string
     * 
     * */
    public static String getNextInput(Scanner scan) {
        String word = scan.nextLine();
        String word2 = (word.split(SEPARATOR)[0]);
        return word2.trim();
    }
}

Related

  1. getInt(Scanner sc)
  2. getInteger(String parameter)
  3. getLines(String str)
  4. getLineStartingWith(Scanner scanner, String starts)
  5. getLngIn()
  6. getNextLine(final Scanner scanner)
  7. getNextLine(final Scanner source)
  8. getNextWord(Scanner scan)
  9. getNextWord(String str, int index, StringBuilder outToken, String ignoreRegex)