replaceInto

fnvoid 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

sinkan output range
subjectthe array to scan
fromthe item to replace
tothe item to replace all instances of from with

See Also

substitute for a lazy replace.
fnvoid 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

sinkan output range
subjectthe array to scan
fromthe item to replace
tothe item to replace all instances of from with
changedthe number of replacements