Find

Finds the first occurrence of a substring in a string, from a specified start position.

Method Signature

Find(substring=[string], string=[string], start=[integer])

Arguments

Argument
Type
Required
Description
Default

substring

string

true

The string you are looking for.

string

string

true

The string to search in.

start

integer

false

The position from which to start searching in the string. Default is 1.

1

Examples

Script Syntax

Run Example

findNoCase( "s", "boxlang.ortusbooks.com", 0 );

Result: 13

Additional Examples

Run Example

writeOutput( findNoCase( "Tree", "Grow the tree, Save the world" ) ); // 10
// Member function
str = "I love boxlang";
writeOutput( str.find( "boxlang" ) );
 // 8

Last updated

Was this helpful?