aslf010990's blog

By aslf010990, 11 years ago, In English

Hello , I have a little doubt : Is there in c ++ the indexOf method ?, greetings

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
11 years ago, hide # |
 
Vote: I like it +4 Vote: I do not like it
     string s = "abacaba";
     cout << s.find("aba")    << "\n"; // 0
     cout << s.find("caba")   << "\n"; // 3
     cout << s.find("x")      << "\n"; // string::npos
     cout << s.find("aba", 2) << "\n"; // 4