去除字符串的空格

来源:互联网 发布:unity3d itween path 编辑:程序博客网 时间:2024/05/01 02:51

写一个函数消除字符串内的空格。代码要求尽量简洁。


void removeSpace(char *str){    char *p = str;char *q = str;do{while (*q == ' '){q++;}}while (*(p++) = *(q++));}


原创粉丝点击