C++ String Find()
This function is used for finding a specified substring.
Consider two strings str1 and str2. Syntax would be :
str : String to be searched for.
pos : It defines the position of the character at which to start the search.
n : Number of characters in a string to be searched for.
ch : It defines the character to search for.
It returns the position of the first character of first match.
Let's see the simple example.
Java is the best programming language Position of the programming word is 17
Let's see simple example by passing position of a character as a parameter.
Mango is my favorite fruit Position of fruit is 21
Let's see simple example of finding a single character.
String contains : javatpoint Position of p is 5