indexOfAny

fnptrdiff_t indexOfAny(Char, Char2)(const(Char)[] haystack, const(Char2)[] needles, in CaseSensitive cs = Yes.caseSensitive) if (isSomeChar!Char && isSomeChar!Char2) @safe pure

Searches the string haystack for one of the characters in needles starting at index startIdx. If startIdx is not given, it defaults to 0.

Parameters

haystackstring to search for needles in
needlescharacters to search for in haystack
startIdxindex of a well-formed code point in haystack to start searching from; defaults to 0
csspecifies whether comparisons are case-sensitive (Yes.caseSensitive) or not (No.caseSensitive)

Returns

The index of the first occurrence of any of the elements of needles in

haystack. If no element of needles is found or startIdx is greater than or equal to haystack.length, then -1 is returned. If the parameters are not valid UTF, the result will still be either -1 or in the range [startIdx .. haystack.length], but will not be reliable otherwise.

Throws

If the sequence starting at startIdx does not represent a well-formed

code point, then a UTFException may be thrown.

fnptrdiff_t indexOfAny(Char, Char2)(const(Char)[] haystack, const(Char2)[] needles, in size_t startIdx, in CaseSensitive cs = Yes.caseSensitive) if (isSomeChar!Char && isSomeChar!Char2) @safe pure

Ditto