更改字符比对

This commit is contained in:
xhm\HP 2024-06-27 14:40:37 +08:00
parent e2dc220aaf
commit d82f308fed
2 changed files with 10 additions and 7 deletions

View File

@ -189,8 +189,8 @@ namespace HisenceYoloDetection
private void MainForm_Load(object sender, EventArgs e)
{
string s1 = "ECO4060##Coton20¡æ##Rapide15mns";
string s2 = "Eco4060##Coton20¡æ##Rapide15mns";
string s1 = "0##Ec04060##20¡æ##Rapide15mns";
string s2 = "ECO4060##20¡ãC##Rapide15mns";
bool st = ManagerModelHelper.StrMatch2(s1, s2);

View File

@ -227,10 +227,13 @@ namespace HisenceYoloDetection
}
static bool AreMoreThanHalfEqual(string[] array1, string[] array2)
{
string Sqltext = array1.Join("");
string Realtext = array2.Join("");
int io = 0;
foreach (string ch1 in array1)
foreach (char ch2 in Realtext)
{
foreach (string ch2 in array2)
foreach (char ch1 in Sqltext)
{
if (ch1 == ch2)
{
@ -249,7 +252,7 @@ namespace HisenceYoloDetection
//int intersectionCount = set1.Intersect(set2).Count();
// 判断交集数量是否超过一半
return io > array1.Length / 2;
return io >=Sqltext.Length / 2;
}
public static bool StrMatch2(string SqlText, string DetText)
{
@ -277,7 +280,7 @@ namespace HisenceYoloDetection
Console.WriteLine("字符串中不包含数字");
}
bool areEqual ;
if (numbers2.Length>2&& numbers.Length > 2)
if (numbers2.Length>0&& numbers.Length > 0)
{
areEqual = AreMoreThanHalfEqual(numbers, numbers2);
}