replaceFirst

fnE[] replaceFirst(E, R1, R2)(E[] subject, R1 from, R2 to) if (isDynamicArray!(E[]) && isForwardRange!R1 && is(typeof(appender!(E[])().put(from[0 .. 1]))) && isForwardRange!R2 && is(typeof(appender!(E[])().put(to[0 .. 1]))))

Replaces the first occurrence of from with to in subject.

Parameters

subjectthe array to scan
fromthe item to replace
tothe item to replace from with

Returns

A new array without changing the contents of subject, or the original

array if no match is found.