String conversion in C++

How do you convert a PureWeb string to a standard string in C++?

This is a question we get asked frequently, and so we decided to add the instructions as a cheat sheet.


APIs:

String.ToStdUtf8() | C++

To convert a PureWeb string to a standard UTF 8 string, use the ToStdUtf8 method in the String class.

This method takes the string expressed as a CSI::String and converts it to a std::string for you.

Here's what the conversion would look like for a string variable labeled "someString":

CSI::String someString;
std::string = someString.ToStdUtf8();