Skip to content

Instantly share code, notes, and snippets.

@chaitanyagupta
Created September 18, 2020 10:35
Show Gist options
  • Save chaitanyagupta/058f171e7f927554c393674a36f58e0d to your computer and use it in GitHub Desktop.
Save chaitanyagupta/058f171e7f927554c393674a36f58e0d to your computer and use it in GitHub Desktop.
(defun search-and-replace-all (old new string)
(loop
with start = 0
for pos = (search old string :start2 start)
while pos
do (setf string (concatenate 'string
(subseq string 0 pos)
new
(subseq string (+ pos (length old))))
start (+ pos (length new))))
string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment