View source code
							
							
						
								Display the source code in std/array.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function std.array.replaceFirst
Replaces the first occurrence of from with to in subject.
						
				E[] replaceFirst(E, R1, R2)
				(
				
				  E[] subject,
				
				  R1 from,
				
				  R2 to
				
				)
				
				if (isDynamicArray!(E[]) && isForwardRange!R1 && is(typeof(appender!(E[])()
				Parameters
| Name | Description | 
|---|---|
| subject | the array to scan | 
| from | the item to replace | 
| to | the item to replace fromwith | 
Returns
A new array without changing the contents of subject, or the original
        array if no match is found.
Example
auto a = [1, 2, 2, 3, 4, 5];
auto b = aAuthors
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.