Ok, Roger's approach, with the use of amend, is definitively the fastest one.
Anyway I put here a full-tacit version, for multiple replacements:

sr=: 13 : '(#>{:x)}. ; ({:x) , each (<:#>{.x)}. each ((>{.x)E.(>{.x),y)<;._1
(>{.x),y'
f=: 13 : '(2}.>{.y) ; (2{.>{.y) sr >{:y'
t=: 13 : '1<#>{.y'
stringreplace=: 13 : '>{: f^:t^:_ (,x);y'f.

Just a train of 108 primitives!

Note:
I'm not able to put in tacit form the "amend" solution

Lorenzo Tomei


-- 
View this message in context: 
http://www.nabble.com/tacit-stringreplace-tp20476004s24193p20501642.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to