Answers for "how to slice string with space in c++"

C++
0

remove space in string c++

string removeSpaces(string str)
{
    stringstream s(str);
    string temp;
    str = "";
    while (getline(s, temp, ' ')) {
        str = str + temp;
    }
    return str;
}
//Input: Ha Noi Viet Nam
//Output: HaNoiVietNam
Posted by: Guest on April-16-2021

Code answers related to "how to slice string with space in c++"

Browse Popular Code Answers by Language