#include <iostream>
#include <Windows.h>
#include <Stdlib.h>
using namespace std;
int main(void) {
char sz[] = "1 2 z1 " ;
char *p = sz;
int len = strlen(p);
cout << p << endl;
/*Clear Space*/
while (*p) {
if ((' ' == *p ))//||( '1'==*p)
lstrcpy(p, p + 1);
if ((' ' != *p)) // || ('1' == *p)
p++;
}
/*Clear Space*/
cout << sz << endl;
system("Pause");
return EXIT_SUCCESS;
}
【Cpp】删除字符串空格
最新推荐文章于 2020-11-22 08:25:37 发布