int CStringTool::Replace(std::wstring& strContent, std::wstring& strReplace, std::wstring & strDest)  

{  

    while (true)  

    {  

        size_t pos = strContent.find(strReplace);  

        if (pos != std::wstring::npos)  

        {  

            WCHAR pBuf[1]={L'\0'};  

            strContent.replace(pos, strReplace.length(), pBuf, 0);  

            strContent.insert(pos, strDest);  

        }  

        else  

        {  

            break;  

        }  

    }  

  
 

    return 0;  

}  

 

From: http://blog.csdn.net/hellochenlian/article/details/17410133

c++ string wstring 字符串替换的更多相关文章

  1. std::string 字符串替换

    std::string 没有原生的字符串替换函数,需要自己来完成 string& replace_str(string& str, const string& to_repla ...

  2. nyoj 113 字符串替换 (string中替换函数replace()和查找函数find())

    字符串替换 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 编写一个程序实现将字符串中的所有"you"替换成"we"   输入 ...

  3. python 字符串替换功能 string.replace()可以用正则表达式,更优雅

    说起来不怕人笑话,我今天才发现,python 中的字符串替换操作,也就是 string.replace() 是可以用正则表达式的. 之前,我的代码写法如下,粗笨: 自从发现了正则表达式也生效后,代码变 ...

  4. StackOverFlow排错翻译 - Python字符串替换: How do I replace everything between two strings without replacing the strings?

    StackOverFlow排错翻译 - Python字符串替换: How do I replace everything between two strings without replacing t ...

  5. php中几个字符串替换函数详解

    在php中字符替换函数有几个如有:str_replace.substr_replace.preg_replace.preg_split.str_split等函数,下面我来给大家总结介绍介绍. 一.st ...

  6. .Net字符串替换

    在.Net中,有些地方需要进行字符的替换才能实现一些相关功能,这里是一个简单的字符串替换的方法 //如下,变量strWhere中是通过一些方法获取的sql拼接的条件语句,但在数据库中是多表查询,有同名 ...

  7. ACM 字符串替换

    字符串替换 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 编写一个程序实现将字符串中的所有"you"替换成"we"   输入 ...

  8. C#中正则表达式进行忽略大小写的字符串替换

    在C#里要进行忽略大小写的字符串替换,用string的Replace是很难做到的,即使花了天大的力气做到了,效率仍然是很低的,正确的方法应该是使用正则表达式. 要使用正则表达式,首先需要引用命名空间: ...

  9. poj 3981 字符串替换

    字符串替换 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10871   Accepted: 5100 Descriptio ...

随机推荐

  1. Nginx配置直接php

    nginx配置文件: server { listen 80; server_name localhost; access_log /var/log/nginx/log/host.access.log ...

  2. CentOS 7搭建KVM在线管理面板WebVirtMgr之使用SSH授权登录

    环境:CentOS 7.4 1.创建SSH私钥和ssh配置选项(在安装了WebVirtMgr的系统上): # 切换到nginx用户su - nginx -s /bin/bash # 生产ssh密钥 s ...

  3. spring-boot 速成(5) profile区分环境

    maven中的profile概念,在spring-boot中一样适合,只要约定以下几个规则即可: 一.不同环境的配置文件以"application-环境名.yml"命名 举个粟子: ...

  4. .net core下的dotnet全局工具

    .net core 2.1后支持了一个全新的部署和扩展命令,可以自己注册全局命令行. dotnet install tool -g dotnetsaydotnetsay 也可以自己构建自己的命令行,一 ...

  5. HDU 4816 Bathysphere (2013长春现场赛D题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 2013长春区域赛的D题. 很简单的几何题,就是给了一条折线. 然后一个矩形窗去截取一部分,求最 ...

  6. Bitbox : a small open, DIY 32 bit VGA console

    Bitbox : a small open, DIY 32 bit VGA console Hi all, I've been developing a simple DIY console and ...

  7. 记录Linux启动流程的工具bootchart

    /*********************************************************************  * Author  : Samson  * Date   ...

  8. 【elasticsearch】关于elasticSearch的基础概念了解【转载】

    转载原文:https://www.cnblogs.com/chenmc/p/9516100.html 该作者本系列文章,写的很详尽 ================================== ...

  9. WordPress主题开发:实现分页功能

    注意的是这个受后台这里的文章篇数设置所影响~ 一.使用内置方法 (WordPress 4.1以前无效) the_posts_pagination 输出分页式导航,用法: <?php the_po ...

  10. Scala从零開始:使用Intellij IDEA写hello world

    引言 在之前的文章中,我们介绍了怎样使用Scala IDE也就是eclipse中集成的Scala开发插件来进行Scala语言程序的开发,在使用了一段时间之后,发现eclipse对Scala的支持并非非 ...