#include <wx/string.h>
#include <wx/crt.h>
#include <iostream>
#include <wx/intl.h>
using namespace std;
int main(int argc,char **argv)
{
printf("\n\rlocale is %s",setlocale(LC_ALL,NULL));//必须加的,否则中文不会正常显示
setlocale(LC_ALL, "");
// setlocale(LC_ALL, "zh_CN.UTF-8");
// setlocale(LC_ALL, "zh_CN.GBK");
// setlocale(LC_ALL, "");
// setlocale(LC_CTYPE, "");
wxString str1 = wxT("Linux");
wxString str2 = wxT("操作");
wxString str3 = wxT("系统");
wxString str = str1 + wxT(" ") + str2 + str3;
printf("\n\rlocale is %s",setlocale(LC_ALL,NULL));
wprintf("\n\r1.printf=" + str);
wxPrintf("\n\r3.wxPrintf=%s" , str.ToStdWstring());
wxPuts("\n\r4.wxPuts=" + str.ToStdWstring());//推荐用ToStdWstring,不出错。
cout<<"\n\r5.cout="<<str<<endl;
cout<<"\n\rSystemEncodingName="<<wxLocale::GetSystemEncodingName()<<endl;
//包含函数测试
if(str.Contains(_("Linux"))){
wxPuts(_("字符串中包含了Linux"));
}else{
wxPuts(_("不包含!"));
}
//字符串长度
long iCount = str.Len();
wxPrintf("len = %lld\n",str.Len());
wxPrintf("len = %zu\n",str.Len());
wxPrintf("len = %lld\n",sizeof(str.Len()));
//大小写
wxPuts(str.MakeLower());
wxPuts(str.MakeUpper());
wxPuts(str.Lower());
system("pause");//暂停
}