拆分字符串异常?

Splitting String with exception?

我有这样的字符串

string text = "224|3|0|0|0|0|0|0|0|0|0|0|0|0|2|You go back to meet the person from the Future.|1|You will be moved.|82|0|0|0|0|0|0|0|0|0|0|0|0|0|0|81|0|0|0|";

如何拆分“|”这个管道字符有例外,所以结果将是这样的 3 部分?

22430000000000002
You go back to meet the person from the Future.|1|You will be moved.
820000000000000081000

我试过了:

string[] line = text.Split('|');
Console.Write(line[0]); //until line[15] For print section #1 

Console.Write(line[line.length-2]); //until line[line.length-20] For print section #3

文本是动态的,所以可能在第 2 部分是

You go back to meet the person from the Future.|1|You will be moved.|2|Hello

所以当索引达到 [16] 时,文本直到 line.length-20 才被拆分 这可能吗 ? 谢谢!!

有点做作,但假设您想将内部字母与外部数字分开:

string text = "224|3|0|0|0|0|0|0|0|0|0|0|0|0|2|You go back the person from the Future.|1|You will be moved.|82|0|0|0|0|0|0|0|0|0|0|0|0|0|0|81|0|0|0|";

var first = String.Join("", text.TakeWhile(c => Char.IsDigit(c) || c == '|'));

var third = String.Join("", text.Reverse().TakeWhile(c => Char.IsDigit(c) || c == '|').Reverse());

var second = text.Replace(first, "").Replace(third, "");