1 ///
2 /// 蛮力法实现字符串匹配
3 ///
4 ///
5 ///
6 ///
7 private static bool IsContains(string longStr, string shortStr)
8 {
9 //字符串总长度
10 int longLength = longStr.Length;
11 //匹配字符串的长度
12 int shortLength = shortStr.Length;
13 int j;
14 //是否匹配成功的标志,默认未匹配成功
15 bool isFunded = false;
16 for (int i &#61; 0; i <&#61; longLength-shortLength; i&#43;&#43;)
17 {
18 j &#61; 0;
19 while (j
20 {
21 j&#43;&#43;;
22 }
23 if (j &#61;&#61; shortLength)
24 {
25 isFunded &#61; true;
26 break;
27 }
28 }
29 return isFunded;
30 }