2

In C++/CX Windows App Store, how do we perform string split based on space, for Platform::String^? I just can't find the Split function.

ildjarn
  • 62,044
  • 9
  • 127
  • 211
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875

1 Answers1

1

There probably isn't a split method because Microsoft has said (for now) that they don't intend to add one. In the documentation for the Platform::String class they state:

Text in the Windows Runtime is represented in C++/CX by the Platform::String Class. Use the Platform::String Class when you pass strings back and forth to methods in Windows Runtime classes, or when you are interacting with other Windows Runtime components across the application binary interface (ABI) boundary. The Platform::String Class provides methods for several common string operations, but it's not designed to be a full-featured string class. In your C++ module, use standard C++ string types such as wstring for any significant text processing, and then convert the final result to Platform::String^ before you pass it to or from a public interface. It's easy and efficient to convert between wstring or wchar_t* and Platform::String. (Source: http://msdn.microsoft.com/en-us/library/windows/apps/hh699879.aspx)

Given what's above your best bet is to work with strings from std and work with one of the many different implementations of split. There are some great recommendations here.

I hope this helps.

Community
  • 1
  • 1
Maurice Reeves
  • 1,572
  • 13
  • 19