"lastIndexOf" (string::lastIndexOf)

Returns the index position of the last occurrence of the string s in this string.

Synopsis

int string.lastIndexOf(string s, int from = -1, CaseSensitivity cs = CaseSensitive);

Parameters

Parameter Description
s String to be searched.
from Start index for the search.
cs

Decides if the search is case sensitive. Can be either:

  • string::CaseSensitive
  • string::CaseInsensitive

Description

Returns the index position of the last occurrence of the string s in this string, searching backward from index position from.

If from is -1 (default), the search starts at the last character; if from is -2, at the next to last character and so on.

Returns -1 if s is not found.

Assignment

String