publ

宿松ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為
成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!ic static double SimilarityNoContains(string a, string b)
{
string a1 = "";
string b1 = "";
if (a==b)
{
return 1;
}
//消除重復(fù)
for (int i = 0; i < a.Length; i++)
{
string emtpy = a.Substring(i, 1).ToString();
if (a1.Length == 0)
{
a1 = emtpy;
}
if (a1.IndexOf(emtpy, 0) < 0)
{
a1 += emtpy;
}
}
//消除重復(fù)
for (int i = 0; i < b.Length; i++)
{
string emtpy = b.Substring(i, 1).ToString();
if (b1.Length == 0)
{
b1 = emtpy;
}
if (b1.IndexOf(emtpy, 0) < 0)
{
b1 += emtpy;
}
}
//計(jì)算相似度
if (a1.Length >= b1.Length)
{
int q = 0;
for (int i = 0; i < b1.Length; i++)
{
for (int j = 0; j < a1.Length; j++)
{
if (b1.Substring(i, 1).ToString() == a1.Substring(j, 1).ToString())
{
q += 1;
}
}
}
System.Globalization.NumberFormatInfo provider = new System.Globalization.NumberFormatInfo();
provider.PercentDecimalDigits = 2;//小數(shù)點(diǎn)保留幾位數(shù).
provider.PercentPositivePattern = 1;//百分號(hào)出現(xiàn)在何處.
double result = (double)q / (a1.Length + b1.Length - q);//一定要用double類型.
return result;
}
else
{
int q = 0;
for (int i = 0; i < a1.Length; i++)
{
for (int j = 0; j < b1.Length; j++)
{
if (a1.Substring(i, 1).ToString() == b1.Substring(j, 1).ToString())
{
q += 1;
}
}
}
System.Globalization.NumberFormatInfo provider = new System.Globalization.NumberFormatInfo();
provider.PercentDecimalDigits = 2;//小數(shù)點(diǎn)保留幾位數(shù).
provider.PercentPositivePattern = 1;//百分號(hào)出現(xiàn)在何處.
double result = (double)q / (a1.Length + b1.Length - q);//一定要用double類型.
return result;
}
}
名稱欄目:判斷兩個(gè)字符相似度-創(chuàng)新互聯(lián)
文章起源:http://aaarwkj.com/article32/dohopc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、云服務(wù)器、網(wǎng)站改版、用戶體驗(yàn)、動(dòng)態(tài)網(wǎng)站、做網(wǎng)站
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源:
創(chuàng)新互聯(lián)