Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.File;
  3.  
  4. public class RemoveAndReplace {
  5.  
  6. static ArrayList<String> strings = new ArrayList<String>();
  7.  
  8. public static void main(String[] args) {
  9. RemoveAndReplace test = new RemoveAndReplace();
  10. try {
  11. Scanner scanner = new Scanner(new File(args[0]));
  12. while (scanner.hasNext()) {
  13. strings.add(scanner.next());
  14. }
  15. } catch (Exception e) {
  16. }
  17.  
  18. //ArrayList<String> a = new ArrayList<String>(strings);
  19. while (true) {
  20. System.out.println("nPress 1 to remove all occurences of a word nPress 2 to exitn:");
  21. Scanner s = new Scanner(System.in);
  22. String command = s.next();
  23.  
  24. if (command.equals("1")) {
  25. test.word();
  26. } else if (command.equals("2")) {
  27. System.exit(0);
  28. }
  29. }
  30. }
  31.  
  32.  
  33.  
  34. public void letter() {
  35.  
  36. int let;
  37. Scanner replaceLetter = new Scanner(System.in);
  38. System.out.println("What letter/s would you like to remove?");
  39. String badLetter = replaceLetter.next();
  40. replaceLetter.close();
  41.  
  42. System.out.print(strings);
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement