Guf*_*ffa 21
指定所需的最大项目数:
string[] splitted = text.Split(new string[]{" - "}, 2, StringSplitOptions.None);
Run Code Online (Sandbox Code Playgroud)
Agi*_*Jon 13
string s = "a - b - c";
string[] parts = s.Split(new char[] { '-' }, 2);
// note, you'll still need to trim off any whitespace
Run Code Online (Sandbox Code Playgroud)