Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created February 11, 2017 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/12153a033cd5f0ace90d2246eea218bd to your computer and use it in GitHub Desktop.
Save chuck0523/12153a033cd5f0ace90d2246eea218bd to your computer and use it in GitHub Desktop.
#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