This function has an interesting history.
Someone or something in #guile had clued me there was a magic string-replace-substring somewhere in guile-user archives. With some luck I found it, and had bookmarked it, and kept it at the back of my mind for a good number of months.
Meanwhile I was steadily learning guile, and cleaning up GnuCash. Noting GnuCash still supports use of guile-2.0, I was finally able to use Mark's implementation to fix a bad one[1]. After discussing this change with GnuCash's lead developer, we realised that upgrading the embedded guile in GnuCash in Windows to 2.2 would solve a whole lot of i18n issues, which it did.
Hence in a roundabout way, we are thankful for the original post and the discussion[2] around it.