Tuple of the split portions of haystack (see above for
details). This sub-type of Tuple defines opCast!bool, which returns true when the separating needle was found and false otherwise.
auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2)These functions find the first occurrence of needle in haystack and then split haystack as follows.
findSplit returns a tuple result containing three ranges.
result[0] is the portion of haystack before needleresult[1] is the portion of
haystack that matches needle
result[2] is the portion of haystack
after the match.
If needle was not found, result[0] comprehends haystack entirely and result[1] and result[2] are empty.
findSplitBefore returns a tuple result containing two ranges.
result[0] is the portion of haystack before needleresult[1] is the balance of haystack starting with the match.If needle was not found, result[0] comprehends haystack entirely and result[1] is empty.
findSplitAfter returns a tuple result containing two ranges.
result[0] is the portion of haystack up to and including the
match
result[1] is the balance of haystack starting
after the match.
If needle was not found, result[0] is empty and result[1] is haystack.
In all cases, the concatenation of the returned ranges spans the
entire haystack.
If haystack is a random-access range, all three components of the tuple have the same type as haystack. Otherwise, haystack must be a
the type of result[0] (and result[1] for findSplit) is the same as the result of takeExactly.
For more information about pred see find.
pred | Predicate to compare 2 elements. |
haystack | The forward range to search. |
needle | The forward range to look for. |
Tuple of the split portions of haystack (see above for
details). This sub-type of Tuple defines opCast!bool, which returns true when the separating needle was found and false otherwise.