"indexOf" (string::indexOf)

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

Synopsis

int string.indexOf(string s, int from = 0, 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 first occurrence of the string s in this string, searching forward from index position from.

Returns -1 if s is not found.

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

Assignment

String