Advertisement
Guest User

Untitled

a guest
Aug 4th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.50 KB | None | 0 0
  1. (define replacements (list (list "a" "A")(list "b" "B") (list "c" "C")))
  2.  
  3. (define (string-replace-multi str lst)
  4.   (cond
  5.     [(empty? lst) str]
  6.     [(eq? (length lst) 1)
  7.      (string-replace str
  8.                      (first (first lst))
  9.                      (last (first lst)))]
  10.     [else
  11.      (string-replace-multi (string-replace str
  12.                                            (first (first lst))
  13.                                            (last (first lst)))
  14.                            (rest lst))]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement