a multiple replace- function
Posted: Wed Apr 04, 2007 4:55 pm
I've again found myself thinking that it would be nice to be able to make a series of replacements with a single call:
- well, there could be loads of them. Putting the pairs into a list is OK:
but it would be neater to have a 'replace-all' or 'replace-each' function, that takes lists:
Could be cool - but perhaps it wouldn't work?
I don't know why I posted this in the Windows area. Sorry. Slip of the mouse...
Code: Select all
(replace "Sherlock" text "Ellery" 0)
(replace "Holmes" text "Queen" 0)
Code: Select all
(map (fn (e) (replace (first e) text (last e) 0)) '(("Sherlock" "Ellery") ("Holmes" "Queen")))
Code: Select all
(replace-each '("Sherlock" "Holmes") text '("Ellery" "Queen") 0)
I don't know why I posted this in the Windows area. Sorry. Slip of the mouse...