C++ string Finding substrings in string objects

Description

C++ string Finding substrings in string objects

#include <iostream>
#include <string>
using namespace std;
int main()//from  w  w w.j a va2s  .c  o  m
{
   string s1 ="aeiou this is a test test another test";
   int n;
   n = s1.find("test");
   cout << "Found at " << n << endl;
   n = s1.find_first_of("is");
   cout << "First at " << n << endl;
   n = s1.find_first_not_of("aeiouAEIOU");
   cout << "First consonent at " << n << endl;
   return 0;
}



PreviousNext

Related