#include <iostream> #include <string> using namespace std; int main(){ string str = "abcDEF"; // string 型の変数を初期化する。 cout << str.length() << endl; // 文字列の文字数を取得する。 cout << str.find("c") << endl; // "c"の文字の[位置]を見つける。 cout << str.substr(2, 3) << endl; // [2]文字目から3文字抜き出す。 cout << str + str << endl; // 文字列を連結する。 cout << str.empty() << endl; // 文字列が空かどうか判定する。 str.clear(); // 文字列を空にする。 cout << str.empty() << endl; // 文字列が空かどうか判定する。 system("pause"); return 0; }