草庐IT

indexStart

全部标签

c# - 提取两个字符串之间的所有字符串

我正在尝试开发一种方法来匹配两个字符串之间的所有字符串:我已经试过了,但它只返回第一个匹配项:stringExtractString(strings,stringstart,stringend){//Youshouldcheckforerrorsinreal-worldcode,omittedforbrevityintstartIndex=s.IndexOf(start)+start.Length;intendIndex=s.IndexOf(end,startIndex);returns.Substring(startIndex,endIndex-startIndex);}假设我们有这