Question: package stringfilterfirstlast; public class FilterFirstLast { /** Searches text for the first and last instances of a given character. * Returns the text with the

package stringfilterfirstlast;
public class FilterFirstLast {
/** Searches text for the first and last instances of a given character.
* Returns the text with the first and last instances of character removed.
* If the character does not appear in the text, the whole text must be returned intact.
* If the character only appears in the text once, then then the text must
* be returned with the first instance of character removed.
* e.g. "revere" and 'e' would return "rver"
* @param text Text to be searched.
* @param searchingFor A character to search for in the text.
* @return Text with first and last instances of character removed.
* */
public static String filterFirstLast(String text, char searchingFor)
package stringfilterfirstlast; public class FilterFirstLast { /** Searches text for the first

String filter first last Implement the function public static String filterFirstLast(String text, char searchingFor) in the manner described by the comments. The following may be useful: indexof (2 substring()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!