[C#] c#拼音模糊匹配算法 →→→→→进入此内容的聊天室

来自 , 2019-12-31, 写在 C#, 查看 110 次.
URL http://www.code666.cn/view/880610aa
  1. private bool IsPinyinMatch(char[] keys, char[] destination)
  2.     {
  3.         int i = 0, j = 0;
  4.         while (i < keys.Length && j < destination.Length)
  5.         {
  6.             if (keys[i] == destination[j])
  7.             {
  8.                 i++;
  9.                 if (i == keys.Length) return true;
  10.             }
  11.             j++;
  12.         }  www.2cto.com
  13.         return false;
  14.     }
  15.     private bool IsPinyinMatch(String keys, String destination)
  16.     {
  17.         return IsPinyinMatch(keys.ToCharArray(), destination.ToCharArray());
  18.     }
  19.  
  20. private bool IsPinyinMatch(char[] keys, char[] destination)
  21.     {
  22.         int i = 0, j = 0;
  23.         while (i < keys.Length && j < destination.Length)
  24.         {
  25.             if (keys[i] == destination[j])
  26.             {
  27.                 i++;
  28.                 if (i == keys.Length) return true;
  29.             }
  30.             j++;
  31.         }
  32.         return false;
  33.     }
  34.     private bool IsPinyinMatch(String keys, String destination)
  35.     {
  36.         return IsPinyinMatch(keys.ToCharArray(), destination.ToCharArray());
  37.     }

回复 "c#拼音模糊匹配算法"

这儿你可以回复上面这条便签

captcha