Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4.     /**
  5.     * @author aothma2s
  6.     */
  7.  
  8.     public class Eingabe {
  9.  
  10.        
  11.     public static int filter(String start,String stop,String skip){
  12.         int anz= 0;
  13.         Scanner sc = new Scanner(System.in);
  14.         String result = "";
  15.         String s = "";
  16.         while(sc.hasNext()){
  17.            
  18.             s = sc.next();
  19.             if(s.equals(start)){
  20.                 while(sc.hasNext() && !s.equals(stop))
  21.                 {
  22.                     s = sc.next();
  23.                 }
  24.             }
  25.             else if(s.equals(skip))
  26.             {
  27.                 s = sc.nextLine();
  28.                
  29.             }
  30.             else {
  31.                
  32.                 result = result + s + " ";
  33.                 ++anz;
  34.             }
  35.            
  36.         }
  37.        
  38.         System.out.println(result);
  39.         return anz;
  40.        
  41.     }
  42.    
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement