Created
February 11, 2017 04:56
-
-
Save chuck0523/12153a033cd5f0ace90d2246eea218bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using std::cin; | |
using std::cout; | |
using std::string; | |
using std::endl; | |
int main() { | |
string sameChars = "aaa"; | |
string notSameChars = "abab"; | |
// std::string::find_first_not_of(hoge) : | |
// hoge以外の文字が最初に見つかった場所 || string::npos を返す | |
cout << sameChars.find_first_not_of("a") << endl; // npos | |
cout << notSameChars.find_first_not_of("a") << endl; // 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment