O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

find — Find a substring in a string

Usage

String.find(str, substr)

str : String

substr : String

Description

Returns the index of the first instance of substring substr in the string str. The first character in the string has index zero. Returns -1 if there is no occurrence of substr in str.

Returns invalid if either str or substr can’t be converted to a string.

Examples

String.find("Example", "x")

returns integer 1

String.find("Example", "mp")

returns integer 3

String.find("Example", "plf")

returns integer -1

String.find("ababababab", "baba")

returns integer 1

String.find(123456, 45)

returns integer 3

String.find(invalid, "foo")

returns invalid

String.find("foo", invalid)

returns invalid

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required