zoukankan      html  css  js  c++  java
  • 先测试下风格

    20924 /**************************************
    20925 [liuzhuan]
    20926 **************************************/
    20927 std::string m_replace(std::string strSrc, const std::string &oldStr, const std::string &newStr, int count=-1){
    20928 std::string strRet=strSrc;
    20929 size_t pos = 0;
    20930 int l_count=0;
    20931 
    20932 if(-1 == count){
    20933 count = strRet.size();
    20934 }
    20935 
    20936 while ((pos = strRet.find(oldStr, pos)) != std::string::npos){
    20937 strRet.replace(pos, oldStr.size(), newStr);
    20938 
    20939 if(++l_count >= count)
    20940 break;
    20941 
    20942 pos += newStr.size();
    20943 }
    20944 return strRet;
    20945 }

  • 相关阅读:
    结构和联合
    字符串、字符和字节
    数组
    函数
    指针
    操作符和表达式
    语句
    数据
    TinyXML2 使用
    是否忘记了向源中添加“#include "StdAfx.h"”?
  • 原文地址:https://www.cnblogs.com/liuzhuan23/p/12877794.html
Copyright © 2011-2022 走看看