关闭

wxString字串轉換

1255人阅读 评论(0) 收藏 举报
wxString字串轉換
char*、TCHAR*、wxString三種字串轉換
char*->TCHAR*

        char *ansii_string = "some text";

        int size = strlen(ansii_string);

        TCHAR unicode_string[30];

        mbstowcs(unicode_string, ansii_string, size+1);

TCHAR*->char*

        TCHAR* unicode_string=_T("unicode string");

        int size= wcslen(unicode_string);

        char ansi_string[30];

        wcstombs(ansi_string, unicode_string, size+1);

wxString->char*

        wxString wx_string=_T("wx string");

        char ansi_string[30];

        strcpy(ansi_string,wx_string.mb_str());

char*->wxString

        char *ansii_string = "some text";

        wxString wx_string(ansii_string,wxConvUTF8);

wxString->TCHAR*

        wxString wx_string=_T("wx string");

        TCHAR wchar_string[30];

        wcscpy(wchar_string,wx_string.wc_str());

TCHAR*->wxString

        TCHAR *tchar_string = _T("some text");

        wxString wx_string(tchar_string,wxConvUTF8);
**************************************************************
wxString::operator <<

wxString& operator <<(const wxString& str)

wxString& operator <<(const char* psz)

wxString& operator <<(char ch)

Same as +=.

wxString& operator <<(int i)

wxString& operator <<(float f)

wxString& operator <<(double d)

These functions work as C++ stream insertion operators: they insert the given value into the string. Precision or format cannot be set using them, you can use Printf for this.

参考     http://www.wxwidgets.org/manuals/2.6.3/wx_wxstring.html#wxstringtodouble
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:158933次
    • 积分:2046
    • 等级:
    • 排名:第18847名
    • 原创:31篇
    • 转载:54篇
    • 译文:1篇
    • 评论:34条
    最新评论
    休闲