Convert NSString to wxString

133 views
Skip to first unread message

Igor Korot

unread,
Nov 17, 2012, 2:47:50 AM11/17/12
to wx-u...@googlegroups.com
Hi, ALL,
Google gives links to wxString->NSString conversion,
but I need to do it the other way as I need to return wxString
from the NSString.

Thank you.

Vadim Zeitlin

unread,
Nov 17, 2012, 5:50:57 PM11/17/12
to wx-u...@googlegroups.com
On Fri, 16 Nov 2012 23:47:50 -0800 Igor Korot wrote:

IK> Google gives links to wxString->NSString conversion,
IK> but I need to do it the other way as I need to return wxString
IK> from the NSString.

You can use wxCFStringRef class from include/wx/osx/core/cfstring.h which
has AsString() method. See many examples of its use in wxOSX for more
details.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Rob B

unread,
Nov 27, 2012, 4:48:04 PM11/27/12
to wx-u...@googlegroups.com
I have used the following to convert in both directions, NSString and wxString:

#include <wx/osx/core/cfstring.h>

wxString to NSString:

NSString_output=wxCFStringRef(wxString_input).AsNSString()

NSString to wxString:

wxString_output=wxCFStringRef::AsString(NSString_input);


Reply all
Reply to author
Forward
0 new messages