/*去除空格函数*/
void RemoveSpaces(){
int i = 0, j,k=0;
char str[CharN];
for (k = 0; k < STRLEN;k++)
{
str[k] = PicturePixelTemporary[k];//输入字符串
i++;
}
str[i] = '\0';
for (i = 0; str[i] != '\0'; i++)
{
if (str[i] == ' ')
{
for (j = i + 1; str[j] != '\0'; j++)
{
str[j - 1] = str[j];
}
str[j] = '\0';
}
else continue;
}
str[i - 2] = '\0';
cout<<"去掉空专格属后的字符串为:\n";
for (i = 0; str[i] != '\0'; i++)
//printf("%c", str[i]);
//printf("\n");
cout << str;
}
c/c++ 去掉空格函数
最新推荐文章于 2024-05-06 10:59:50 发布