Is there an equivalent in C++ of PHP's explode() function? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Splitting a string in C++ In PHP, the explode() function will take a string and chop it up into an array separating each element by a specified delimiter. Is there an equivalent function in C++? 回答1: Here's a simple example implementation: #include <string> #include <vector> #include <sstream> #include <utility> std::vector<std::string> explode(std::string const & s, char delim) { std::vector<std::string> result