[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Global change to strings...

I have a rather embarrasingly simple question. I suspect it is a Common
Lisp rather than a specifically MACL question- and apologize if it is.
I have spent all afternoon with Franz's 'Common Lisp: The Language' and
with 'Common Lisp: The Reference' AND with the MACL docs, and I still
can not figure out how to do a global change in a Lisp string. I need to
be able to replace every instance of (say) 'x' with (say) 'a different
word'. Surely Lisp and/or MACl provide some means to do this with
different length keys...but I have tried various combinations of
'REPLACE' and 'SUBSTITUTE' and I can see that I can write a function
which copies character by character...but surely this must be built-in
to the language! The problem isn't doing the replacing per se; it's
doing it so that no other part of the string is overwritten or left
hanging after the new insertion.

I do apologize in adding to the heavy mail with this question which must
have a trivial answer...but I'm at my rope's end over this idiocy.