Element - øṄ
- Replace Nth Occurrence
Description
Replace the nth instance of an item with another item. If n is negative, then replaces the last nth instance.
Overloads
any-any-any-any
-a.replace_nth_occurrence(b, c, d)
Examples
`abcabc` `c` `H` 1 øṄ
=`abHabc`
⟨1|2|3|4|1|2|3|4⟩ 3 6 1 øṄ
=⟨1|2|6|4|1|2|3|4⟩
⟨1|1|1|1⟩ 1 4 3 øṄ
=⟨1|1|4|1⟩
`aaaa` `G` `w` 1 øṄ
=`aaaa`
⟨1|2|3|4⟩ 5 6 2 øṄ
=⟨1|2|3|4⟩
`abcaabc` `a` `d` -2 øṄ
=`abcdabc`
⟨1|2|2|3|4|2|5|3⟩ 2 8 -1 øṄ
=⟨1|2|2|3|4|8|5|3⟩
⟨2|3|4⟩ 2 4 1 øṄ
=⟨4|3|4⟩
234 2 4 1 øṄ
=434
234 2 `4` 1 øṄ
=`434`
234 `2` 4 1 øṄ
=434
`234` 2 4 1 øṄ
=`434`
`234` `2` 4 1 øṄ
=`434`
`abbbabbb` `bb` `c` 1 øṄ
=`acbabbb`
`abbbabbb` `bb` `c` 2 øṄ
=`abcabbb`
`abbbabbb` `bb` `c` 3 øṄ
=`abbbacb`
`abbbabbb` `bb` `c` 4 øṄ
=`abbbabc`