std::string 字符替换函数

// 替换路径中所有“\”为“/”
#include <algorithm>
static std::string ConvertSlash(std::string& strUrl)
{
    //size_t nLen = strlen(strPicTruePathBuff);
    //for (size_t i = 0 ; i < nLen; i++)
    //{
    //    if (strPicTruePathBuff[i] == '\\')
    //     strPicTruePathBuff[i] = '/';
    //}

    std::replace(strUrl.begin(), strUrl.end(), '\\', '/');
    return strUrl;
}

 

posted @ 2014-03-01 22:52  Tigmer  阅读(4194)  评论(0)    收藏  举报