• wxstring与其他类型转换


    wxstring与其他类型转换

     1 1.1 int to wxString:    
     2 wxString str = wxString::Format(wxT("%i"),myInt);
     3 1.2   wxString to int :     
     4 int i; i = wxAtoi(str);
     5 1.3   string to wxString:    
     6 std::string stlString = "sdfas"; wxString mystr(stlString .c_str(),wxConvUTF8);
     7 1.4   wxString to string:    
     8 wxString mystring(wxT("HelloWorld"));
     9 std::string stlstring = std::string(mystring.mb_str());
    10 1.5  char* to wxString:
    11 char* chars = "Hello world";
    12 wxString mystring(chars, wxConvUTF8);
    13 1.6   wxString to  char*:   
    14 char* cs = str.mb_str(wxConvUTF8);
    15 法2:wxString to UTF-8 to char*(即string)
    16 wxString wx;const wxCharBuffer wxc = wx.ToUTF8(); const char *wxs= wxc;
    17 1.7    char[] to wxString:
    18 char chars[34] = "sefasd";
    19 wxstring mystring(chars, wxConvUTF8);
    20 1.8  wxString to char[]:
    21 wxString mystring(wxT("HelloWorld"));
    22 char cstring[1024];
    23 strcpy(cstring, (const char*)mystring.mb_str(wxConvUTF8));
    24  
    25 wxdatetime 与wxstring转换
    26 2.1  wxdatetime to wxstring :
    27 wxDateTime dt = CalendarCtrl1->GetDate();
    28 wxString msg = dt.Format(wxT("%Y-%m-%d"),wxDateTime::A_EST);
    29 2.2 wxstring to wxdatetime:   char* ca = "2008-09-03";wxDateTime dt;dt.ParseDate(ca);
    
    
  • 相关阅读:
    node相关--socket.io
    node相关--WebSocket
    node工具--express
    node工具--connect
    HTTP基础01--web与互联网基础
    nodeAPI--HTTP
    nodeAPI--TCP
    js:语言精髓笔记13--语言技巧
    js:语言精髓笔记12--动态语言特性(2)
    js:语言精髓笔记11--动态语言特性(1)
  • 原文地址:https://www.cnblogs.com/starf/p/3657149.html
Copyright © 2020-2023  润新知