【C++】使用boost库的split函数分割字符串
1 #include <iostream> 2 #include <vector> 3 #include <boost/algorithm/string.hpp> 4 5 int main(const int argc, const char* argv[]) 6 { 7 std::vector<std::string> vRet; 8 boost::split(vRet, "dilex.liu", boost::is_any_of(".")); 9 for (std::string& str: vRet) 10 { 11 std::cout << str << std::endl; 12 } 13 return 0; 14 }