-1
string text = "try your {{equal|even out|regularize}  out|steady|tied|equal}";

实际上,我想将外括号 ( {}) 内的所有单词分开。

例如,如果这是字符串:"{{equal|even out|regularize} out|steady|tied|equal}",我希望拆分结果数组是这样的: { equal, even out, regularize, out, stable,tie, equal }

string text = "try your {{equal|even out|regularize}  out|steady|tied|equal}  {champion|finest|top-quality}";

string1 = "try";
string2 = "your";
string3="{{equal|even out|regularize}  out|steady|tied|equal}";
string4="{champion|finest|top-quality}";

如何分裂这样...请帮助我...谢谢!

4

1 回答 1

1

尝试这个 :

string text = "try your {{equal|even out|regularize}  out|steady|tied|equal}";
text = text.Remove(0, text.IndexOf('{'));
var array = text.Split('{', '}', '|');
array.ToList().ForEach(item =>
{
      Console.WriteLine(item);
});

输出 :

equal
even out
regularize
  out
steady
tied
equal
于 2013-08-09T12:12:41.143 回答