in reply to Re: Iterating over an array variable times
in thread Iterating over an array variable times
I have a string of letters, e.g. 'ABCDEF'. I want to insert the letter 'N' into each position so I can end up with:
NABCDEF ANBCDEF ABNCDEF ... ABCDEFN
At other times I'll need to insert a second N into the string, which is the output given in a previous post:
NNABCDEF NANBCDEF ... ABCDEFNNWhether I need one or two iterations is controled by an input that we can call $num.
I can do this insertion for one instance and also for two instances, but I've written them as two sets of code. I'm wondering if there's a way to do it in once block of code.
many thanks
|
|---|