string-replace-list
Name
string-replace-list -- Replace a list of target substrings in a string
Synopsis
(string-replace-list string replace-list)
Description
Replaces, in string, all occurances of each target in
replace-list with its replacement.
Author
Norman Walsh, <ndw@nwalsh.com>
Source Code
(define (string-replace-list string replace-list)
;; Replace a list of target substrings in a string
(let loop ((str string) (pos 0))
(if (>= pos (string-length str))
str
(loop (repl-substring-list str replace-list pos)
(if (repl-substring-list? str replace-list pos)
(+ (string-length
(repl-substring-list-repl str replace-list pos))
pos)
(+ 1 pos))))))