View source code
					
 Display the source code in std/algorithm/searching.d from which this page was generated on
 github.
					
				
				
 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.
					
				
				
 Page wiki
					
 View or edit the community-maintained wiki page associated with this page.
					
				
			
			Function std.algorithm.searching.findSkip
			 Finds  in needle and positions haystack
 right after the first occurrence of haystack.
needle
Prototype
bool findSkip(alias pred, R1, R2)( R1 haystack, R2 needle ) if (isForwardRange!R1 && isForwardRange!R2 && is(typeof(binaryFun!pred(haystack.front, needle.front))));
Parameters
| Name | Description | 
|---|---|
| haystack | The forward range to search in. | 
| needle | The forward range to search for. | 
Returns
true if the needle was found, in which case  is
 positioned after the end of the first occurrence of haystack; otherwise
 needlefalse, leaving  untouched.
haystack
Example
// Needle is found; s is replaced by the substring following the first // occurrence of the needle. string s = "abcdef"; assert(findSkip(s, "cd") && s == "ef"); // Needle is not found; s is left untouched. s = "abcdef"; assert(!findSkip(s, "cxd") && s == "abcdef"); // If the needle occurs at the end of the range, the range is left empty. s = "abcdef"; assert(findSkip(s, "def") && s.empty);