completed my string replacement function.