X244: withoutString

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".

Examples:

withoutString("Hello there", "llo") -> "He there"
withoutString("Hello there", "e") -> "Hllo thr"
withoutString("Hello there", "x") -> "Hello there"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.