std.string.last_index_of
- multiple declarations
- Function lastIndexOf
- Function lastIndexOf
- Function lastIndexOf
- Function lastIndexOf
Function lastIndexOf
Prototype
ptrdiff_t lastIndexOf(Char1, Char2)( const(Char1)[] s, const(Char2)[] sub, size_t startIdx, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char1 && isSomeChar!Char2);
Parameters
Name | Description |
---|---|
s | string to search |
sub | substring to search for |
startIdx | the index into s to start searching from |
cs | CaseSensitive.yes or CaseSensitive.no |
Returns
the index of the last occurrence of
in sub
. If s
is not found, then sub
-1
is returned. The
slices startIdx
in
the following way s
. s
[0 .. startIdx
]
represents a
codeunit index in startIdx
. If the sequence ending at s
does not
represent a well formed codepoint, then a startIdx
std.utf.UTFException
may be
thrown.
indicates whether the comparisons are case sensitive.
cs
Function lastIndexOf
Prototype
ptrdiff_t lastIndexOf(Char1, Char2)( const(Char1)[] s, const(Char2)[] sub, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char1 && isSomeChar!Char2);
Parameters
Name | Description |
---|---|
s | string to search |
sub | substring to search for |
cs | CaseSensitive.yes or CaseSensitive.no |
Returns
the index of the last occurrence of
in sub
. If s
is not found, then sub
-1
is returned.
indicates whether the comparisons are case sensitive.
cs
Function lastIndexOf
Prototype
ptrdiff_t lastIndexOf(Char)( const(Char)[] s, dchar c, size_t startIdx, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char);
Parameters
Name | Description |
---|---|
s | string to search |
c | character to search for |
startIdx | the index into s to start searching from |
cs | CaseSensitive.yes or CaseSensitive.no |
Returns
The index of the last occurrence of
in c
. If s
is
not found, then c
-1
is returned. The
slices startIdx
in
the following way s
. s
[0 .. startIdx
]
represents a
codeunit index in startIdx
. If the sequence ending at s
does not
represent a well formed codepoint, then a startIdx
std.utf.UTFException
may be
thrown.
indicates whether the comparisons are case sensitive.
cs
Function lastIndexOf
Prototype
ptrdiff_t lastIndexOf(Char)( const(Char)[] s, dchar c, CaseSensitive cs = CaseSensitive.yes ) pure @safe if (isSomeChar!Char);
Parameters
Name | Description |
---|---|
s | string to search |
c | character to search for |
cs | CaseSensitive.yes or CaseSensitive.no |
Returns
The index of the last occurrence of
in c
. If s
is not found, then c
-1
is returned.
indicates whether the comparisons are case sensitive.
cs
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis