From c910a492dbf9ded8fbf6ac9a45863c91bcd2344f Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Mon, 14 Oct 2024 09:34:45 +0530 Subject: [PATCH] Update OOP/Java/Lab/Week9/replacing.java --- OOP/Java/Lab/Week9/replacing.java | 51 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/OOP/Java/Lab/Week9/replacing.java b/OOP/Java/Lab/Week9/replacing.java index 405fd5a..2d42795 100644 --- a/OOP/Java/Lab/Week9/replacing.java +++ b/OOP/Java/Lab/Week9/replacing.java @@ -1,27 +1,26 @@ -import java.util.Scanner; -class replacing{ - public static void main(String[] args) { - Scanner in=new Scanner(System.in); - System.out.println("Enter the Lines..."); - String str=in.nextLine(); - str.trim(); - System.out.println("Enter the word to be removed"); - String word=in.nextLine(); - StringBuffer strbuf= new StringBuffer(str); - if(str.contains(word)) - { - - int index=str.indexOf(word); - int wlen=word.length(); - String - String rep=""; - for(int i=0;i