Java Scanner Usage termInput()

Here you can find the source of termInput()

Description

term Input

License

Open Source License

Declaration

public static String termInput() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Scanner;

public class Main {
    public static String termInput() {
        Scanner in = new Scanner(System.in);
        String result = "";
        boolean done = false;

        // Read query terms (String) from the keyboard
        while (!done) {
            result = in.nextLine();//www.  j av  a 2 s . c  om

            if (result.length() < 3) {
                System.out
                        .println("Please enter at least one keyword that's "
                                + "at least 3 characters long:");
            } else {
                done = true;
            }
        }
        return result;
    }
}

Related

  1. splitLines(String string)
  2. splitToDouble(String input)
  3. stringToArray(String str)
  4. stringToDoubleList(String s)
  5. swapElements(int length, int maxValue)
  6. Tokenize(String s, String s2, String s3)
  7. toNumeric(String ip)
  8. toWords(String content)
  9. transformTXTandANNtoRQS(String TXT, String ANN)