也许用简单的string方法:
IList<String> foundStrings = new List<String>();
int currentIndex = 0;
int index = str.IndexOf("(", currentIndex);
while(index != -1)
{
int start = index + "(".Length;
int colonIndex = str.IndexOf(":", start);
if (colonIndex != -1)
{
string nextFound = str.Substring(start, colonIndex - start);
foundStrings.Add(nextFound);
}
currentIndex = start;
index = str.IndexOf("(", currentIndex);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
156 次 |
| 最近记录: |