regex:replace-everything   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;; where finds and replaces
;; are equal length lists
(define regex:replace-everything
  (lambda (str finds replaces)
    (if (<> (length finds) (length replaces))
        (impc:compiler:print-compiler-error "regex:replace-everything expects an equal number of finds and replaces"))
    (for-each (lambda (find replace)
                (if (not (string=? find replace))
                    (let ((s (regex:replace-all str find replace)))
                      (set! str s))))
              finds replaces)
    str))


Back to Index