Interval option specifier for until (below) and others.
Checks whether r has "balanced parentheses", i.e. all instances of lPar are closed by corresponding instances of rPar. The parameter maxNestingLevel controls the nesting level allowed. The most common uses are the default or 0. In the latter case, no nesting is allowed.
Sets up Boyer-Moore matching for use with find below. By default, elements are compared for equality.
Returns the common prefix of two ranges.
Counts matches of needle in haystack.
Counts all elements or elements satisfying a predicate in haystack.
Counts elements in the given forward range until the given predicate is true for one of the given needles.
Checks if the given range ends with (one of) the given needle(s). The reciprocal of startsWith.
Finds an element e of an input range where pred(e) is true.
$(PANEL $(UL $(LI `find` behaves similarly to `dropWhile` in other languages.) $(LI To _find the *last* matching element in a $(REF_ALTTEXT bidirectional, isBidirectionalRange, std,range,primitives) `haystack`, call `find!pred(retro(haystack))`. See $(REF retro, std,range).) ))
Finds an individual element in an input range. Elements of haystack are compared with needle by using predicate pred with pred(haystack.front, needle). The predicate is passed to std.functional.binaryFun, and can either accept a string, or any callable that can be executed via pred(element, element).
Finds two or more needles into a haystack. The predicate pred is used throughout to compare elements. By default, elements are compared for equality.
Finds needle in haystack efficiently using the Boyer-Moore method.
Advances r until it finds the first two adjacent elements a, b that satisfy pred(a, b). Performs O(r.length) evaluations of pred.
Searches the given range for an element that matches one of the given choices.
Finds needle in haystack and positions haystack right after the first occurrence of needle.
These functions find the first occurrence of needle in haystack and then split haystack as follows.
Computes the minimum (respectively maximum) of range along with its number of occurrences. Formally, the minimum is a value x in range such that pred(a, x) is false for all values a in range. Conversely, the maximum is a value x in range such that pred(x, a) is false for all values a in range (note the swapped arguments to pred).
Iterates the passed range and returns the maximal element. A custom mapping function can be passed to map. In other languages this is sometimes called argmax.
Computes the index of the first occurrence of range's maximum element.
Computes a subrange of range starting at the first occurrence of range's minimum (respectively maximum) and with the same ending as range, or the empty range if range itself is empty.
Computes the minimum (respectively maximum) of range along with its number of occurrences. Formally, the minimum is a value x in range such that pred(a, x) is false for all values a in range. Conversely, the maximum is a value x in range such that pred(x, a) is false for all values a in range (note the swapped arguments to pred).
Iterates the passed range and returns the minimal element. A custom mapping function can be passed to map. In other languages this is sometimes called argmin.
Computes the index of the first occurrence of range's minimum element.
Computes a subrange of range starting at the first occurrence of range's minimum (respectively maximum) and with the same ending as range, or the empty range if range itself is empty.
Checks whether the given input range starts with (one of) the given needle(s) or, if no needles are given, if its front element fulfils predicate pred.
Lazily iterates range until the element e for which pred(e, sentinel) is true.
Sets up Boyer-Moore matching for use with find below. By default, elements are compared for equality.
Lazily iterates range until the element e for which pred(e, sentinel) is true.
Checks if _all of the elements satisfy pred.
Checks if _any of the elements satisfies pred. !any can be used to verify that none of the elements satisfy pred. This is sometimes called exists in other languages.
Convenience function. Like find, but only returns whether or not the search was successful.
Skip over the initial portion of the first given range (haystack) that matches any of the additionally given ranges (needles) fully, or if no second range is given skip over the elements that fulfill pred. Do nothing if there is no match.
This is a submodule of std.algorithm. It contains generic searching algorithms.
count([1, 2, 1]) returns 3, count([1, 2, 1], 1) returns 2 and count!"a < 0"([1, -3, 0]) returns 1.