SyntaxFix
Write A Post
Hire A Developer
Questions
If you don't care about case, then you perhaps it doesn't matter if it returns all upcase:
target.toUpperCase().replace("FOO", "");