Selectively replace multiple instances of a character within a string: Difference between revisions

m
Line 125:
<tt>upd</tt> here takes four arguments -- two on the left (replacement characters, original character) and two on the right(index values for which instances to replace, and the original string).
 
However, here's a more compact approach (the first item in the left argument is the target, and the rest of the left argument explicitly provides values for every instance of that item in the right argument):
However, here's a more compact approach:
 
<lang J> chg=: {{ (}.x) (I.y={.x)} y}}
6,962

edits