A. C语言中去掉空格问题
/*去除字符串右边空格*/
void
vs_strrtrim(char
*pstr)
{
char
*ptmp
=
pstr+strlen(pstr)-1;
while
(*ptmp
==
'
')
{
*ptmp
=
'\0';
ptmp--;
}
}
/*去除字符串左边空格*/
void
vs_strltrim(char
*pstr)
{
char
*ptmp
=
pstr;
while
(*ptmp
==
'
')
{
ptmp++;
}
while(*ptmp
!=
'\0')
{
*pstr
=
*ptmp;
pstr++;
ptmp++;
}
*pstr
=
'\0';
}