String find

Return the index of a substring (if found). Returns -1 if not found.

Syntax

The format is:

str.find(string)

or

str.find(string,start,end)

Parameters

Parameter
str
The string to search.
start
Index to start searching (optional).
end
Ending index (optional).

Example

str = "Tip of the day: "
print( str.find("day") )

Result:


11