You could create your own splitString
function. Here is an example:
std::vector<std::string> splitString(std::string str, char splitter){
std::vector<std::string> result;
std::string current = "";
for(int i = 0; i < str.size(); i++){
if(str[i] == splitter){
if(current != ""){
result.push_back(current);
current = "";
}
continue;
}
current += str[i];
}
if(current.size() != 0)
result.push_back(current);
return result;
}
And here is an example usage:
int main(){
vector<string> result = splitString("This is an example", ' ');
for(int i = 0; i < result.size(); i++)
cout << result[i] << endl;
return 0;
}
Or how you want to use it:
int main(){
vector<string> result = splitString("Hello world!", ' ');
string str1 = result[0];
string str2 = result[1];
cout << str1 << endl;
cout << str2 << endl;
return 0;
}