Advertisement
Guest User

Untitled

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