DSSSL Library Reference: Part of the Modular DocBook Stylesheet distribution
Prev |  | Next

# repl-substring?

## Name

repl-substring? -- Returns true if the specified substring can be replaced

## Synopsis

    (repl-substring? string target pos)

## Description

Returns `#t` if `target` occurs at `pos` in `string`.

## Author

Norman Walsh, <ndw@nwalsh.com>

## Source Code

    (define (repl-substring? string target pos)
      ;; Returns true if the specified substring can be replaced
      (let* ((could-match (<= (+ pos (string-length target))
    			 (string-length string)))
    	 (match (if could-match
    		    (substring string pos (+ pos (string-length target))) "")))
        (and could-match (string=? match target))))

Prev | Home | Next
string-list-sosofo | Up | repl-substring