List of usage examples for java.util Scanner nextLine
public String nextLine()
From source file:GGbot.pkg0.Mainclass.java
public static void main(String[] args) throws InterruptedException, TwitterException, DbxException, IOException, Exception { String input = ""; System.out.println("Welcomet to GGbot\nFor more information please take a look at the Read Me\n"); System.out.println("- Twitter: PlayerName (flex, returns the latest tweets from a player)\n" + "- Facebook: PlayerName (flex, returns all the information available about a player)\n" + "- Note to self: Input (notflex, create a new text document with your input, and put it in a drop box)\n" + "- Translate: Input (notflex, detects the language of your input and translate it to english)\n" + "- Wiki (flex, returns the definition of league of legends from wikipedia\n" + "- !Players: (returns the list of the players available in the library (only players from the teams: Cloud9, CLG, and TSM are available at the moment))\n" + "- !dropbox: (returns the link to the dropbox)\n\n" + "Start to chat now!\n"); while (!input.contains("bye")) { System.out.print("<User>"); Scanner scanner = new Scanner(System.in); input = scanner.nextLine(); String output = bot.Bot(input.toLowerCase().trim()); System.out.println("<GGbot>" + WordUtils.wrap(output, 75)); }//ww w. j a v a 2 s.co m }
From source file:Main.java
public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(new File("c:/text.txt"), StandardCharsets.UTF_8.name()); System.out.println(scanner.nextLine()); scanner.close();//from w w w . j a va 2 s . c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(FileSystems.getDefault().getPath("logs", "access.log")); System.out.println(scanner.nextLine()); scanner.close();//from w w w. j a v a 2s .co m }
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()); scanner.close();// ww w .j ava 2 s .c o m }
From source file:jshm.util.Crypto.java
public static void main(String[] args) { Scanner s = new Scanner(System.in); String in = s.nextLine(); System.out.println(args.length > 0 && args[0].toLowerCase().startsWith("d") ? decrypt(in) : encrypt(in)); }
From source file:Main.java
public static void main(String[] args) { String s = "java2s.com \n 1 + 1 = 2.0 "; Scanner scanner = new Scanner(s); // print the next line System.out.println(scanner.nextLine()); // check if there is a next line again System.out.println(scanner.hasNextLine()); System.out.println(scanner.nextLine()); // check if there is a next line again System.out.println(scanner.hasNextLine()); scanner.close();// w w w. ja va2s. c om }
From source file:Main.java
public static void main(String[] args) throws Exception { File file = new File("data.txt"); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); Scanner lineScanner = new Scanner(line); lineScanner.useDelimiter(","); while (lineScanner.hasNext()) { String part = lineScanner.next(); System.out.print(part + ", "); }/* ww w . ja v a2 s . c om*/ System.out.println(); } }
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 v a2 s. c o m }
From source file:Main.java
public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new FileInputStream("c:/text.txt").getChannel()); System.out.println(scanner.nextLine()); // change the radix of the scanner scanner.useRadix(32);/* w ww . j a v a 2 s . c o m*/ // display the new radix System.out.println(scanner.radix()); scanner.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(new FileInputStream("c:/text.txt"), StandardCharsets.UTF_8.name()); System.out.println(scanner.nextLine()); scanner.close();/*w ww.j av a 2 s. c om*/ }