110,534
社区成员
发帖
与我相关
我的任务
分享
string str1 = xxx;
string str2 = xxx;
int len = str1.Length;
if(len > str2.Length)
{
len = str2.Length;
}
//Process
char[] chars1 = str1.ToArray();
char[] chars2 = str2.ToArray();
for(int i=0 ; i < len; i++)
{
bool isEqual = (char1[i] == char2[i]);
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.IO;
namespace CSharpTest
{
class B
{
static void Main()
{
string str1 = "abcde", str2 = "bbddef";
int num=0;
if (str1.Length > str2.Length)
{
for (int i = 0; i < str2.Length; i++)
if (str2[i] == str1[i]) num++;
}
else
{
for (int i = 0; i < str1.Length; i++)
if (str2[i] == str1[i]) num++;
}
Console.WriteLine(num);
}
}
}