VC++:
CString str = "123 34 sd dewdew ";
str.Remove(' ');
C++
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char *argv[ ])
{
string s("ab bb bb s 3 3 3 3"), s1;
stringstream ss;
istringstream iss;
iss.str(s);
iss >> s1;
while (!s1.empty())
{
ss << s1;
iss >> s1;
}
cout << ss.str();
return 0;
}
C:
char chr[] = "ab er sd s 3 6 7 5", chr2[200], *pSrcStart=chr, *pSrcEnd, *pDest=chr2;
while (pSrcEnd = strchr(pSrcStart, ' '))
{
strncpy(pDest, pSrcStart, pSrcEnd-pSrcStart);
pDest += pSrcEnd-pSrcStart;
pSrcStart = pSrcEnd+1;
}
strcpy(pDest, pSrcStart);
cout << chr2;
return 0;
CString str = "123 34 sd dewdew ";
str.Remove(' ');
C++
#include <iostream>
#include <sstream>
using namespace std;
int main(int argc, char *argv[ ])
{
string s("ab bb bb s 3 3 3 3"), s1;
stringstream ss;
istringstream iss;
iss.str(s);
iss >> s1;
while (!s1.empty())
{
ss << s1;
iss >> s1;
}
cout << ss.str();
return 0;
}
C:
char chr[] = "ab er sd s 3 6 7 5", chr2[200], *pSrcStart=chr, *pSrcEnd, *pDest=chr2;
while (pSrcEnd = strchr(pSrcStart, ' '))
{
strncpy(pDest, pSrcStart, pSrcEnd-pSrcStart);
pDest += pSrcEnd-pSrcStart;
pSrcStart = pSrcEnd+1;
}
strcpy(pDest, pSrcStart);
cout << chr2;
return 0;
http://myajax95./