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 - multiple declarations

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

NameDescription
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 sub in s. If sub is not found, then -1 is returned. The startIdx slices s in the following way s[0 .. startIdx]. startIdx represents a codeunit index in s. If the sequence ending at startIdx does not represent a well formed codepoint, then a std.utf.UTFException may be thrown.

cs indicates whether the comparisons are case sensitive.

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

NameDescription
s string to search
sub substring to search for
cs CaseSensitive.yes or CaseSensitive.no

Returns

the index of the last occurrence of sub in s. If sub is not found, then -1 is returned.

cs indicates whether the comparisons are case sensitive.

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

NameDescription
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 c in s. If c is not found, then -1 is returned. The startIdx slices s in the following way s[0 .. startIdx]. startIdx represents a codeunit index in s. If the sequence ending at startIdx does not represent a well formed codepoint, then a std.utf.UTFException may be thrown.

cs indicates whether the comparisons are case sensitive.

Function lastIndexOf

Prototype

ptrdiff_t lastIndexOf(Char)(
  const(Char)[] s,
  dchar c,
  CaseSensitive cs = CaseSensitive.yes
) pure @safe
if (isSomeChar!Char);

Parameters

NameDescription
s string to search
c character to search for
cs CaseSensitive.yes or CaseSensitive.no

Returns

The index of the last occurrence of c in s. If c is not found, then -1 is returned.

cs indicates whether the comparisons are case sensitive.

Authors

Walter Bright, Andrei Alexandrescu, and Jonathan M Davis

License

Boost License 1.0.

Comments