[Csharp]
Private bool IsPinyinMatch (char [] keys, char [] destination)
{
Int I = 0, j = 0;
While (I <keys. Length & j <destination. Length)
{
If (keys [I] = destination [j])
{
I ++;
If (I = keys. Length) return true;
}
J ++;
} Www.2cto.com
Return false;
}
Private bool IsPinyinMatch (String keys, String destination)
{
Return IsPinyinMatch (keys. ToCharArray (), destination. ToCharArray ());
}
Private bool IsPinyinMatch (char [] keys, char [] destination)
{
Int I = 0, j = 0;
While (I <keys. Length & j <destination. Length)
{
If (keys [I] = destination [j])
{
I ++;
If (I = keys. Length) return true;
}
J ++;
}
Return false;
}
Private bool IsPinyinMatch (String keys, String destination)
{
Return IsPinyinMatch (keys. ToCharArray (), destination. ToCharArray ());
}
Test example: Enter key1 = "WM", Match: key2 = "wanmeiqianzhuan"
First, use W of key1 to match the first character in Key2. If no match is found, J ++ continues to match the second character in Key2. If the first item is matched, I ++ continues to use the second position of key1 to match the J position of the Key.
.
If key1 is equal to the length of I, and the last digit of key1 matches in key2, return true.