C# 两个字符串的比较

            string StrA = "ABCDE";
            
string StrB = "AE";
            
char[] ArryA = StrA.ToCharArray();
            
char[] ArryB = StrB.ToCharArray();
            
int number = 0;
            
for (int j = 0; j < ArryA.Length; j++)
            {
                
for (int i = 0; i < ArryB.Length; i++)
                {
                    
if (ArryA[j].Equals(ArryB[i]))
                    {
                        number
++;
                    }
                }
            }
            
if (number == StrB.Length)
            {
                Console.WriteLine(
"true");
            }
            
else
            {
                Console.WriteLine(
"false");
            }
            Console.ReadKey();

               
posted @ 2011-05-06 15:57  shizhi57  阅读(696)  评论(1编辑  收藏  举报