std::string comp functions returns wxStringBase

Vadim Zeitlin vadim at wxwindows.org
Sun Dec 3 18:14:30 PST 2006


On Sat, 02 Dec 2006 23:27:54 +0100 Jonas Rydberg <jonas at arbor.se> wrote:

JR> In the documentation of wxString it says that (some of) the std::string 
JR> compatability functions returns wxString, for example substr(). But at 
JR> least in in wx 2.8.0rc1 they return wxStringBase, which means that code 
JR> like this fails:
JR> 
JR> wxString str("hello world");
JR> wxString str2 = str.substr(0, 5).AfterFirst('e');
JR> 
JR> I'm not sure if it's a problem in the documention, or the 
JR> implementation, but at least it's a difference.

 It is a problem in the implementation as it would be definitely better if
it did work, but the trouble is I don't see how to fix it [easily]. So for
now I can only recommend the workaround:

	wxString str2 = str.substr(0, 5);
	str2 = str2.AfterFirst('e');

 Regards,
VZ

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





More information about the wx-users mailing list