Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please show me how to get my code right (my code is on the white background). This is for beginner Java, thank you! public class
Please show me how to get my code right (my code is on the white background). This is for beginner Java, thank you!
public class WithoutString { 1 2 3 4 5 /** Write the method named withoutString(). 6 7 8 Given two strings, base and remove, return a version of the base string where all instances of the remove string have been removed (not case sensitive). You may assume that the remove string is length 1 or more. Remove only non-overlapping instances, so with "xXx" removing "xx" leaves "x". 9 10 11 12 13 14 15 16 17 18 19 20 21 Note: Despite the term "remove" you should actually not try to remove the characters from a string. You'll continue to use the "building a string" pattern from lecture. * * Examples: withoutString("Hello there", "llo") returns "He there" withoutString("Hello there", "e") returns "Hllo thr" withoutString("Hello there", "x") returns "Hello there" @param base the base String to modify. @param remove the substring to remove. @return the base String with all copies of remove removed. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 11 // TODO - Write the withoutString method here public String withoutString(String base, String remove) { String result ""; int len = remove.length(); for (int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started