在一个单词后拆分字符串

sta*_*ser 1 c# split

我想在一个单词之后分割一个字符串,而不是在字符之后.示例字符串:

 A-quick-brown-fox-jumps-over-the-lazy-dog
Run Code Online (Sandbox Code Playgroud)

我想在string 使用该"jumps-"功能后拆分字符串吗?我想要以下输出:

 over-the-lazy-dog. 
Run Code Online (Sandbox Code Playgroud)

Dmi*_*nko 7

我建议使用IndexOf,Substring因为你实际上想要一个后缀(" 一个字一个字"),而不是一个分裂:

  string source = "A-quick-brown-fox-jumps-over-the-lazy-dog";
  string split = "jumps-";

  // over-the-lazy-dog
  string result = source.Substring(source.IndexOf(split) + split.Length);
Run Code Online (Sandbox Code Playgroud)