The OpenD Programming Language

lastIndexOfNeither

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

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

Parameters

haystack const(Char)[]

String to search for needles in.

needles const(Char2)[]

Strings to search for in haystack.

stopIdx size_t

slices haystack like this haystack[0 .. stopIdx] If the stopIdx is greater than or equal to the length of haystack the functions returns -1.

cs CaseSensitive

Indicates whether the comparisons are case sensitive.

Examples

assert(lastIndexOfNeither("abba", "a") == 2);
assert(lastIndexOfNeither("def", "f") == 1);
assert(lastIndexOfNeither("def", "rsa", 3) == -1);
assert(lastIndexOfNeither("abba", "a", 2) == 1);

Meta