Question: implement the following method: public static String replacement(String ori, String r, String w) this method should replace all occurrence of the String r with String
implement the following method:
public static String replacement(String ori, String r, String w)
this method should replace all occurrence of the String r with String w if the total length of String r (number of occurrences X r.length())
is less than 30% of the length of ori String; otherwise, you are going to replace all occurrences of w with r. Then return a String after
applying these rules. for example
replacement ("skiing is fun", "fun", "cool") should return "skiing is cool"
replacement ("AAABB", "A", "C") should return "AAABB"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
