#pragma once #include "stdafx.h" #include using namespace std; #pragma region 字符串处理 //说明:Unicode转换为ANSI,由于系统语言区域设置原因,目前只支持处理英文内容 class CharConvert { #pragma region Unicode和ANSI public: /// /// 多字节字符转换为宽字符 /// static wstring GetWideCharW(char* multiByte); static wstring GetWideCharW(string* multiByte); /// /// 宽字符转换为多字节字符 /// /// /// static char* GetMultiByteW(wchar_t* wideChar); static char* GetMultiByteW(wstring wideStr); static char* GetMultiByteUTF8W(wchar_t* wideChar); static wstring ReplaceSubStrW(wstring sourceStr, const wstring& oldSubStr, const wstring& newSubStr); #pragma endregion #pragma region 字符转换 static char* StringTocharPtrA(string* sourceStr); static wchar_t* wstringToWchar_tPtrW(wstring ws); static char* GetWstringToCharPtr(wstring ws); #pragma endregion }; #pragma endregion