Convert int to string

From WxWiki

Jump to: navigation, search

When I was starting out with wxwidgets I searched for ages for how to convert from a number to a wxstring. I eventually found a forum post with the answer. So I post it here as this was the first place I looked for the answer and now hopefully other newbies to c++ and wxwidgets can find the answer here.

//code
long number_to_convert; // this can be any number type such as int,double...
wxString stringnumber = wxString::Format(wxT("%d"), (int)number_to_convert);


Thats all you need to do now you can play about with it ;)

Personal tools