Code example for Scanner

Methods: hasNextnextuseDelimiter

0
   <tt>disposition =  "grumpy"</tt> 
   <tt>this is the name = this is the value</tt> 
  */ 
  protected void processLine(String aLine){
    //use a second Scanner to parse the content of each line  
    Scanner scanner = new Scanner(aLine);
    scanner.useDelimiter("=");
    if ( scanner.hasNext() ){
      String name = scanner.next();
      String value = scanner.next();
      log("Name is : " + quote(name.trim()) + ", and Value is : " + quote(value.trim()) );
    } 
    else { 
      log("Empty or invalid line. Unable to process."); 
    } 
    //no need to call scanner.close(), since the source is a String 
  } 
   
  // PRIVATE  
  private final File fFile;
Connect your IDE to all the code out there  Get Codota for Java