Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.File;
- public class RemoveAndReplace {
- static ArrayList<String> strings = new ArrayList<String>();
- public static void main(String[] args) {
- RemoveAndReplace test = new RemoveAndReplace();
- try {
- Scanner scanner = new Scanner(new File(args[0]));
- while (scanner.hasNext()) {
- strings.add(scanner.next());
- }
- } catch (Exception e) {
- }
- //ArrayList<String> a = new ArrayList<String>(strings);
- while (true) {
- System.out.println("nPress 1 to remove all occurences of a word nPress 2 to exitn:");
- Scanner s = new Scanner(System.in);
- String command = s.next();
- if (command.equals("1")) {
- test.word();
- } else if (command.equals("2")) {
- System.exit(0);
- }
- }
- }
- public void letter() {
- int let;
- Scanner replaceLetter = new Scanner(System.in);
- System.out.println("What letter/s would you like to remove?");
- String badLetter = replaceLetter.next();
- replaceLetter.close();
- System.out.print(strings);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement