A new array without changing the contents of subject, or the original array if no match is found.
auto a = [1, 2, 2, 3, 4, 5]; auto b = a.replaceFirst([2], [1337]); assert(b == [1, 1337, 2, 3, 4, 5]); auto s = "This is a foo foo list"; auto r = s.replaceFirst("foo", "silly"); assert(r == "This is a silly foo list");
Replaces the first occurrence of from with to in subject.