void ReplaceBlank(char *str,int len)
{
assert(str != NULL);
char *p = str;
int count = 0;
int charNum = 0;
while(*p != '\0')
{
charNum++;
if(*p == ' ')
{
count++;
}
p++;
}//a b c
int newLen = count*2+charNum;//申请新的字符数组长度
if(newLen > len)
{
return;
}
int p2 = newLen;
int p1 = charNum;
//替换
while(p2 > p1 && p1 >= 0)
{
if(str[p1] == ' ')//从后至前替换
{
str[p2--] = '5';
str[p2--] = '2';
str[p2--] = '#';
}
else
{
str[p2--] = str[p1];
}
p1--;
}
}