这是我的字符串:
1-1 This is my first string. 1-2 This is my second string. 1-3 This is my third string.
Run Code Online (Sandbox Code Playgroud)
我怎么能像C#一样打破;
result[0] = This is my first string.
result[1] = This is my second string.
result[2] = This is my third string.
Run Code Online (Sandbox Code Playgroud)
IEnumerable<string> lines = Regex.Split(text, "(?:^|[\r\n]+)[0-9-]+ ").Skip(1);
Run Code Online (Sandbox Code Playgroud)
编辑:如果你想在数组中得到结果,你可以做string[] result = lines.ToArray();