std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
while(std::getline(ss, item, delim)) {
elems.push_back(item);
}
return elems;
}
std::vector<std::string> split(std::string str, char delim = ' ') {
std::vector<std::string> result;
size_t start = 0;
while (start < str.length()) {
size_t pos = str.find(delim, start);
if (pos == std::string::npos) pos = str.length();
result.push_back(str.substr(start, pos - start));
start = pos + 1;
}
return result;
}
Code Example |
---|
Cpp :: function template in c++ |
Cpp :: how to create a structure c++ |
Cpp :: template function in class c++ |
Cpp :: Default code in C++ for VSCode |
Cpp :: while loop c++ |
Cpp :: void pointer c++ |
Cpp :: what does | mean in c++ |
Cpp :: c++ inline if |
Cpp :: c++ handling |
Cpp :: convert c++ to mips assembly code online |
Cpp :: english to french typing online |
C :: hello word c |
C :: unity change transparency script |
C :: get file extension from base64 string |
C :: ruby absolute value |
C :: imprimir valor no octave |
C :: nginx reverse proxy nextcloud |
C :: type change in c |
C :: C program to display fibonacci serice |
C :: C percentage program |
C :: hashmap c |
C :: bootstrap 5 image responsive |
C :: addition in c |
C :: how to scan in c |
C :: array value from user c |
C :: c style string |
C :: geom boxplot remove outliers |
C :: how i send custom data in model field rest_framework serializer |
C :: c find last element in array |
C :: check whether a number is prime or not in c |