C++ String Find()This function is used for finding a specified substring. SyntaxConsider two strings str1 and str2. Syntax would be : Parametersstr : 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. Return valueIt returns the position of the first character of first match. Example 1Let's see the simple example. Output: Java is the best programming language Position of the programming word is 17 Example 2Let's see simple example by passing position of a character as a parameter. Output: Mango is my favorite fruit Position of fruit is 21 Example 3Let's see simple example of finding a single character. Output: String contains : javatpoint Position of p is 5
Next TopicC++ Strings
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week