How to use System::String::Split with a split of three characters?

断了今生、忘了曾经 提交于 2019-12-25 01:58:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!