0

I'm new to C++/CLI and am trying to split a System::String^ with multiple delimiters.

System::String^ = 65 kb (65,546 bytes)
Split
System::String^ = 65546

I've found this code that would be great but it only works for std::string and I'm not allowed to convert System::String^.

std::string s = "65 kb (67,873 bytes)";
std::string delimiter = " (";

size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
    token = s.substr(0, pos);
    std::cout << token << std::endl;
    s.erase(0, pos + delimiter.length());
}

Any ideas on how I would do this?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Adilicious
  • 1,643
  • 4
  • 18
  • 22

1 Answers1

0

You're using a .NET class (System.String). You need a .NET answer: Does C# have a String Tokenizer like Java's?

Community
  • 1
  • 1
xtofl
  • 40,723
  • 12
  • 105
  • 192