Colobot Wiki
Advertisement

Find a substring in a string and returns the position of the first substring found or NaN if the substring has not been found.

Syntax:

strfind ( string, sub );

string: string[]

String we are searching in.

sub: string[]

Substring we are searching for.

Examples:[]

	int pos = strfind("abcdef", "ab"); // pos will be 0
	int pos = strfind("abcdef", "de"); // pos will be 3
	int pos = strfind("abcdef", "xy"); // pos will be nan

See also[]

strlen, strleft, strright, strmid, strval, strupper, strlower

Programming, types, and categories.

Advertisement