Horje
implementing split function in c++ Code Example
implementing split function in c++
// splits a std::string into vector<string> at a delimiter
vector<string> split(string x, char delim = ' ')
{
    x += delim; //includes a delimiter at the end so last word is also read
    vector<string> splitted;
    string temp = "";
    for (int i = 0; i < x.length(); i++)
    {
        if (x[i] == delim)
        {
            splitted.push_back(temp); //store words in "splitted" vector
            temp = "";
            i++;
        }
        temp += x[i];
    }
    return splitted;
}




Cpp

Related
sort function from bigest to smallest c++ Code Example sort function from bigest to smallest c++ Code Example
STD::ERASE FUNCTION IN C++ Code Example STD::ERASE FUNCTION IN C++ Code Example
modulo subtraction Code Example modulo subtraction Code Example
c++ filesystem read directory Code Example c++ filesystem read directory Code Example
c++ map insert Code Example c++ map insert Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9