JString to std::string
Options
Comments
-
Found a way, nevermind...
lib.update(); jText = lib.getStateString(); text = jText.UTF8Representation();
0 -
Hi.
toString() is the stringifying interface. So if you call myOperation.toString(), or myRoom.toString() then it will return you the Content of the instance, on which toString() has been called, as a JString in human readable format. Thats mainly useful for debugging purposes. For example you can check, if data, that you expect in a container, actually is in there and actually has the datatype that you expect it to have.
for reasons of consistency and convenience, JString also implements the ToString interface, although its implementation just returns L"\"" + *this + L"\"", meaning, it does nothing more than adding quotation marks to the returned copy of itself for readability reasons.
JString is a widestring, that internally holds its data in a wchar_t* just like std::wstring does, so its content has to be converted into a narrow string format like UTF8 or the current locale, when converting it to a 8 bit string. This is done by the subclasses of BaseCharString. Please have a look into the doc inside the client SDK for more info about those classes and also about class JString.0