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

# repl-substring

## Name

repl-substring -- Replace substring in a string

## Synopsis

    (repl-substring string target repl pos)

## Description

Replaces `target` with `repl` in `string` at `pos`.

## Author

Norman Walsh, <ndw@nwalsh.com>

## Source Code

    (define (repl-substring string target repl pos)
      ;; Replace substring in a string
      (let ((matches (repl-substring? string target pos)))
        (if matches
    	(string-append
    	 (substring string 0 pos)
    	 repl
    	 (substring string
    		    (+ pos (string-length target))
    		    (string-length string)))
    	string)))

Prev | Home | Next
repl-substring? | Up | repl-substring-list?