(cherry picked from commit 813072186c1c305ea62c7270f1514dfab5166af2)
String::replace_first
String::replace_last