Premature optimization comment: Is this called often?
Cause replaceAllLiterally creates a regex and a replace all, meaning you are paying the cost of compiling a regex 5 times, and copying the string 5 times, when you can just do a for loop and test for character equality.