I am not quite good in C++ STL's. I have string like :
x ,y z , a ,b, some text ,
I want all the spaces in this to be removed except the space which is in between two words So i want the output to be :
x,y z,a,b,some text,
I can easily do this in perl with :
perl -pe 's/\s*,\s*/,/g;s/^\s*//g'
But i need it in C++.
What i can do till now is :
line.erase(remove_if(line.begin(), line.end(), isspace), line.end());
But this removes all the splaces in the line.
I am using a compiler:
> CC -V
CC: Sun C++ 5.9 SunOS_i386 Patch 124864-01 2007/07/25
which does not have regex header