View source code
Display the source code in std/string.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
std.string.last_index_of_neither
- multiple declarations
- Function lastIndexOfNeither
- Function lastIndexOfNeither
Function lastIndexOfNeither
Returns the last index of the first occurence of any character that is not
an elements in
in needles
. If all element of
haystack
are element of haystack
needles
-1
is returned.
Prototype
ptrdiff_t lastIndexOfNeither(Char, Char2)( const(Char)[] haystack, const(Char2)[] needles, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char && isSomeChar!Char2);
Parameters
Name | Description |
---|---|
haystack | String to search for needles in. |
needles | Strings to search for in haystack . |
cs | Indicates whether the comparisons are case sensitive. |
Example
assert(lastIndexOfNeither("abba", "a") == 2); assert(lastIndexOfNeither("def", "f") == 1);
Function lastIndexOfNeither
Returns the last index of the first occurence of any character that is not
an elements in
in needles
. If all element of
haystack
are element of haystack
needles
-1
is returned.
Prototype
ptrdiff_t lastIndexOfNeither(Char, Char2)( const(Char)[] haystack, const(Char2)[] needles, size_t stopIdx, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char && isSomeChar!Char2);
Parameters
Name | Description |
---|---|
haystack | String to search for needles in. |
needles | Strings to search for in haystack . |
stopIdx | slices haystack like this If
the stopIdx is greater equal the length of haystack the functions
returns -1 . |
cs | Indicates whether the comparisons are case sensitive. |
Example
assert(lastIndexOfNeither("def", "rsa", 3) == -1); assert(lastIndexOfNeither("abba", "a", 2) == 1);
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis