Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. /**
  2. * @author aothma2s
  3. */
  4. import java.util.Scanner;
  5. public class Leser {
  6.  
  7.  
  8.  
  9.     public static String  vorNach(Scanner sc)
  10.     {
  11.        
  12.         String ret = "";
  13.        
  14.         String vor_nach = sc.next();
  15.         String word = sc.next();
  16.         String num = sc.next();
  17.        
  18.        
  19.         if(vor_nach.equals("vor") && word.contains(num))
  20.         {
  21.             ret = word.substring(0, word.lastIndexOf(num));
  22.         }
  23.  
  24.            
  25.         else if(vor_nach.equals("nach")) {
  26.                
  27.                
  28.                 ret = word.substring(word.indexOf(num)+1,word.length());
  29.             }
  30.         else
  31.         {
  32.             ret += "";
  33.         }
  34.    
  35.         return vor_nach+" "+ret+" "+"in "+word;
  36.     }
  37.  
  38.  
  39.    
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement