subject, or the original
array if no match is found.
E[] replace(E, R1, R2)(E[] subject, R1 from, R2 to) if ((isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2)) ||
is(Unqual!E : Unqual!R1))Replace occurrences of from with to in subject in a new array.
subject | the array to scan |
from | the item to replace |
to | the item to replace all instances of from with |
subject, or the original
array if no match is found.
substitute for a lazy replace.E[] replace(E, R1, R2)(E[] subject, R1 from, R2 to, ref size_t changed) if ((isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2)) ||
is(Unqual!E : Unqual!R1))Replace occurrences of from with to in subject in a new array. changed counts how many replacements took place.
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 |
subject, or the original
array if no match is found.
T[] replace(T, Range)(T[] subject, size_t from, size_t to, Range stuff) if (isInputRange!Range &&
(is(ElementType!Range : T) ||
isSomeString!(T[]) && is(ElementType!Range : dchar)))Replaces elements from array with indices ranging from from (inclusive) to to (exclusive) with the range stuff.
subject | the array to scan |
from | the starting index |
to | the ending index |
stuff | the items to replace in-between from and to |
subject.substitute for a lazy replace.