//c++之字符串分割: std::string str_buf = "hello/world"; std::vector<std::string> str_arr; split(str_buf, "/", str_arr); for(std::vector<std::string>::iterator it=str_arr.begin(); it != str_arr.end(); it++){ std::cout << "std::string is " << *it << std::endl; } //取vector的最后一个元素: std::string tmp = str_arr[str_arr.size()-1];
时间: 2024-10-13 02:35:38