The OpenD Programming Language

indexOfNeither

Returns the index of the first occurrence of any character not an elements in needles in haystack. If all element of haystack are element of needles -1 is returned.

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

Parameters

haystack const(Char)[]

String to search for needles in.

needles const(Char2)[]

Strings to search for in haystack.

cs CaseSensitive

Indicates whether the comparisons are case sensitive.

Examples

assert(indexOfNeither("abba", "a", 2) == 2);
assert(indexOfNeither("def", "de", 1) == 2);
assert(indexOfNeither("dfefffg", "dfe", 4) == 6);
assert(indexOfNeither("def", "a") == 0);
assert(indexOfNeither("def", "de") == 2);
assert(indexOfNeither("dfefffg", "dfe") == 6);

Meta