首页 > 其他 > 详细

Algorithm delete some charactors from string

时间:2016-10-28 17:46:02      阅读:167      评论:0      收藏:0      [点我收藏+]
bool IsCharBelongString( IN const char* szIn, IN char ch )
{
    if (szIn)
    {
        while (*szIn)
        {
            if (ch == *szIn)
            {
                return true;
            }
            szIn++;
        }
    }
    return false;
}

void DeleteChar( IN char* szIn, IN const char* szDelete )
{
    if (szIn)
    {
        char* pStep1 = szIn;
        char* pStep2 = szIn;
        while (*pStep1)
        {
            if (!DIYIsCharBelongString(szDelete, *pStep1))
            {
                *pStep2++ = *pStep1;
            }
            pStep1++;
        }
        *pStep2 = 0;
    }
}

 

Algorithm delete some charactors from string

原文:http://www.cnblogs.com/nonebutnow/p/6008758.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!