String.indexOfString()

Signature

int indexOfString (String s1, int fromIndex, String s2)

Domain

action, condition, query

Description

Returns the index within this string of the first occurrence of the specified substring or -1 if not present.

Parameters

NameTypeDescription
s1StringA String to search.
fromIndexintThe index within s1 to begin the search.
s2StringA String to search for within the first String argument.

Returns

TypeDescription
intThe index within this string of the first occurrence of the specified substring or -1 if not present.

Cautions

none

Example


int result = String.indexOfString ("This is a test", 2, "is a");

Result is:
result contains: 3.