#include <string>
#ifdef _UNICODE
#define tstring std::wstring
#define __T(quote) L##quote
#else
#define tstring string
#define __T(quote) quote
#endif
#define _T(quote) __T(quote)   
#define _TEXT(quote) __T(quote) 
#define TEXT(quote) __T(quote)
                std::string T2A(const tstring& sInput)
                {
#ifdef _UNICODE
                                return std::string(sInput.begin(), sInput.end());
#else
                                return sInput;
#endif
                };
                tstring A2T(const std::string& sInput)
                {
#ifdef _UNICODE
                                return tstring(sInput.begin(), sInput.end());
#else
                                return sInput;
#endif
                };
int replace_all(tstring& str,  const tstring& pattern,  const tstring& newpat)
{
                int count = 0;
                const size_t nsize = newpat.size();
                const size_t psize = pattern.size();
                for(size_t pos = str.find(pattern, 0); 
                                pos != tstring::npos;
                                pos = str.find(pattern,pos + nsize))
                {
                                str.replace(pos, psize, newpat);
                                count++;
                }
                return count;
}
  

win32 UNICODE 支持的更多相关文章

  1. vc6下unicode支持

    最近在研究一个串口程序,要启用unicode支持,发现还挺麻烦的. VC6.0设定UNICODE编译环境 VC++ 6.0支持Unicode编程,但默认的是ANSI,所以开发人员只需要稍微改变一下编写 ...

  2. Win32程序支持命令行参数的做法(转载)

    转载:http://www.cnblogs.com/lanzhi/p/6470406.html 转载:http://blog.csdn.net/kelsel/article/details/52759 ...

  3. Win32程序支持命令行参数的做法

    作者:朱金灿 来源:http://blog.csdn.net/clever101 首先说说Win 32 API程序如何支持命令行参数.Win 32程序的入口函数为: int APIENTRY _tWi ...

  4. Erlang的Unicode支持

    在R13A中, Erlang加入了对Unicode的支持.本文涉及到的数据类型包括:list, binary, 涉及到的模块包括stdlib/unicode, stdlib/io, kernel/fi ...

  5. moodle3.15+,mysql完全的Unicode支持配置

    https://docs.moodle.org/dev/Releases,moodle个版本升级的主要内容和改动 在windows是mysql.ini  linux 下是mysql.cnf 因为MyS ...

  6. Python: subprocess.Popen()不支持unicode问题解决

    起源: 所下载视频,有音视频分离者,需要合并起来,采用python之subprocess.Popen()调用ffmpeg实现.python版本为2.7.13,而音视频文件路径,有unicode字符者, ...

  7. UNICODE并没有提供对诸如Braille, Cherokee, Ethiopic, Khmer, Mongolian, Hmong, Tai Lu, Tai Mau文字的支持

    UNICODE支持欧洲.非洲.中东.亚洲(包括统一标准的东亚象形汉字和韩国象形文字).但是,UNICODE并没有提供对诸如Braille, Cherokee, Ethiopic, Khmer, Mon ...

  8. 彻底搞定char/wchar_t/unicode

    彻底搞定char/wchar_t!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (2013-07-17 10:18:28) 转载▼     从char/wchar_t到TCHAR(1) ...

  9. C++builder XE10 终于支持类内变量初始化了

    Win32终于支持类内变量初始化了,C++11 用bcc32C编译器  llvm CLang.还支持Unicode 中文汉字 变量名. 用经典的bcc32编译还是不支持! class TPerson ...

随机推荐

  1. smokeping插件使用及说明

    smokeping七大组件:general(普通设置) .alerts(警报设置).Datebase(数据库参数).presentation(网络自定义).slaves(从smokeping定义).t ...

  2. 【Python】IDLE启动错误

    启动IDLE时报Subprocess Startup Error错误 错误信息 IDLE's subprocess didn't make connection.Either IDLE cant't ...

  3. PowerBuilder -- 条码打印

    # 使用ocx控件 使用微软的MSBCODE9.OCX,但是注册老不成功,需要安装office之后才能注册成功,不知道有没有好的处理方法?? # 使用字体 字体下载:http://download.c ...

  4. PowerBuilder -- 键盘对应的枚举值

    KeyCode values for keyboard keys Type of key KeyCode values and descriptions Mouse buttons KeyLeftBu ...

  5. Option可选值可选值(二)

    //: Playground - noun: a place where people can play import Cocoa var str1 = "供选链接和强制拆包的不同. &qu ...

  6. mysqldump导入导出数据库总结

    mysqldump导入导出数据库总结 基本的使用方法总结: 1 导出所有库 系统命令行 mysqldump -uusername -ppassword --all-databases > all ...

  7. JS常用方法手记

    1.判断arr数组是否含有元素str,没有返回-1 arr.indexOf(str) 2.遍历arr数组,k为键,v为值 arr.map((v, k) => { return;}) 3.arr数 ...

  8. 【Java并发编程实战】—–“J.U.C”:ReentrantLock之二lock方法分析

    前一篇博客简介了ReentrantLock的定义和与synchronized的差别,以下尾随LZ的笔记来扒扒ReentrantLock的lock方法.我们知道ReentrantLock有公平锁.非公平 ...

  9. c# combobox 绑定枚举方式

    建立一个类 : using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...

  10. python 基础 5.3 类的重写

    一. 类的重写 只需要重新定义类的属性(变量),就是累的重写了 示例:重新定义类grandson的 name属性   #/usr/bin/python #coding=utf-8 #@Time :20 ...