substitute for a lazy replace.replaceInto
fn
void replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to) if (isOutputRange!(Sink, E) &&
((isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2)) ||
is(Unqual!E : Unqual!R1)))Replace occurrences of from with to in subject and output the result into sink.
Parameters
sink | an output range |
subject | the array to scan |
from | the item to replace |
to | the item to replace all instances of from with |
See Also
fn
void replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to, ref size_t changed) if (isOutputRange!(Sink, E) &&
((isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2)) ||
is(Unqual!E : Unqual!R1)))Replace occurrences of from with to in subject and output the result into sink. changed counts how many replacements took place.
Parameters
sink | an output range |
subject | the array to scan |
from | the item to replace |
to | the item to replace all instances of from with |
changed | the number of replacements |