Oops - sorry - I've had it so long I've forgotten that it's my own:
replace=: 4 : 0
NB.* replace: replace "from" with "to" in vector y..
'from to'=. x.
if. 0~:#str=. ,y. do.
wh=. 1,}.wh0=. from E. str
str=. wh <;.1 str
isin=. ;1 e.&.> (1,}.wh) <;.1 wh0
str=. (isin*''$$,from)}.&.>str
str=. ;(isin#&.><to),&.>str
end.
str
NB.EG ('xx';<'yow') replace 'xx, this rxxplacement xxx works'
)
though it looks like stringreplace works the same way.
On 3/1/07, Bill Harris <[EMAIL PROTECTED]> wrote:
"Devon McCormick" <[EMAIL PROTECTED]> writes:
> NB. where we extend standard replace function:
> multiReplace=: 4 : 0
...
Pardon my blind spot, but where is the "standard replace function"? I
can't find it. I can find rplc, but that didn't work (neither did
x. and y., but I changed those, too).
Thanks,
Bill
...
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm