利用split 和递归做的
private int search(string strValue, char[] searchchar, int index) { var temp = strValue.Split(searchchar[index]); var countt = temp.Count(); if (countt > 1) { ++index; if (temp[0].Length > 0) { if (index < searchchar.Length) index = search(strValue.Replace(temp[0], ""), searchchar, index); } else { if (index < searchchar.Length) index = search(temp[1], searchchar, index); } } return index; }
感觉还行:)
返回值是匹配程度全。