Skip to main content

string.find(searchString, startIndex)

Finds a sub-string within a string

Availability

Device + Agent

Parameters

Name Type Description
searchString String The sub-string you are searching for
startIndex Integer Optional character index at which to start the search

Returns

Integer — the location of the specified sub-string, otherwise null

Description

This method looks for the sub-string passed as its first parameter, starting at either the beginning of the string or at a specific character index if one is provided as a second parameter. If the sub-string is found, find() returns the index at which it first occurs. If the sub-string is not found, the method returns null.

Example Code