String.indexOfString()

Signature

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

Domain

ACTION, CONDITION, QUERY, BUI

Description

Finds the index of the first occurrence of s2 within s1 that is at, or after, fromIndex.

Parameters

NameTypeDescription
s1StringA String to search.
fromIndexintA position within s1.
s2StringA String to find within s1.

Returns

TypeDescription
intReturns the index of the first occurrence of s2 within s1 that is at, or after, fromIndex, if there is one. Else returns -1.

Cautions

none

Example

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

Result is: 5