| The Modular DocBook Stylesheets | ||
|---|---|---|
| Prev | DSSSL Library | Next |
(repl-substring-list? string replace-list pos)
Returns #t if any target in replace-list occurs at pos in string.
The string in which replacement should be tested.
A list of target/replacement pairs. This list is just a list of strings, treated as pairs. For example, ("was" "x" "is" "y"). In this example, was may be replaced by x and is may be replaced by y.
The location within string where the test will occur.
(repl-substring-list? "this is it" ("was" "x" "is" "y") 2) returns #t: "is" could be replaced by "y".
Norman Walsh, <norm@berkshire.net>
(define (repl-substring-list? string replace-list pos)
;; Perform repl-substring? with a list of target/replacement pairs
(let loop ((list replace-list))
(let ((target (car list))
(repl (car (cdr list)))
(rest (cdr (cdr list))))
(if (repl-substring? string target pos)
#t
(if (null? rest)
#f
(loop rest))))))| Prev | Home | Next |
| repl-substring-list | Up | repl-substring |
Copyright © 1997, 1998 Norman Walsh