| The Modular DocBook Stylesheets | ||
|---|---|---|
| Prev | DSSSL Library | Next |
(string-replace string target repl)
Replaces all occurances of target in string with repl.
Norman Walsh, <norm@berkshire.net>
(define (string-replace string target repl)
;; Replace all occurances of a target substring in a string
(let loop ((str string) (pos 0))
(if (>= pos (string-length str))
str
(loop (repl-substring str target repl pos)
(if (repl-substring? str target pos)
(+ (string-length repl) pos)
(+ 1 pos))))))| Prev | Home | Next |
| string-replace-list | Up | string-with-space |
Copyright © 1997, 1998 Norman Walsh