问题
namely, I want to split by a sequence of three white spaces, and then split again by a newline. I tried doing it, but it doesn't work:
array<wchar_t>^ separator = {' '};
array<String^>^ QandA = x->Split(separator );
Anyone?
回答1:
System.String.Split() contains an overload that takes an array of String as a delimiter. So make a new array with the one element " /n/r" (or is it /r/n.. I can never remember), and use that as your delimiter.
回答2:
Regex::Split should work with complex delimiters, including multi-character sequences.
来源:https://stackoverflow.com/questions/7742919/how-to-use-systemstringsplit-with-a-split-of-three-characters