#include<sstream> string str = "hello world"; stringstream ss(str); string temp; while(ss >> temp) { cout<<temp<<endl; }
string str = "hello world"; cout<<str.substr(0,2)<<endl;
C++ 字符串
原文:https://www.cnblogs.com/alilliam/p/13385031.html