JackHoughton00

Remove String

Mar 23rd, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package removestring;
  2. import java.util.Scanner;
  3. public class RemoveString {
  4.  
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7. String sentence, str;
  8. System.out.print("Enter a sentence:");
  9. sentence = input.nextLine();
  10. System.out.print("Enter a string:");
  11. str = input.nextLine();
  12. input.close();
  13. sentence = sentence.replaceAll(str,"");
  14. System.out.print(sentence);
  15. }
  16.  
  17. }
Add Comment
Please, Sign In to add comment