方法一:

string test = "FF FF FF FF 01 00 82 00 00 A2 00 00 FB 07 FF FF FF FF 01 00 82 00 00 A2 00 00 FB 07";
string r = test.Replace("FF FF FF FF","");
int num = (test.Length - r.Length) /11; //(11是'FF FF FF FF'的长度)
Response.Write(num);

 

方法二:

string aaa = "aabaabbaabb";
int a=  aaa.Split(new string[] { "aa" }, StringSplitOptions.None).Length-1;

 

 

posted on 2013-08-21 12:17  Haydy  阅读(2169)  评论(0编辑  收藏  举报