Esempio n. 1
0
 private static string GetStringWubiCode(GetWubiCode getWubiCode, string str)
 {
     if (str.Length == 1)
     {
         return getWubiCode(str[0]);
     }
     if (str.Length == 2)
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         return code1.Substring(0, 2) + code2.Substring(0, 2);
     }
     if (str.Length == 3)
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         string code3 = getWubiCode(str[2]);
         return code1[0].ToString() + code2[0].ToString() + code3.Substring(0, 2);
     }
     else
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         string code3 = getWubiCode(str[2]);
         string code4 = getWubiCode(str[str.Length - 1]);
         return code1[0].ToString() + code2[0] + code3[0] + code4[0];
     }
 }
Esempio n. 2
0
 private static string GetStringWubiCode(GetWubiCode getWubiCode, string str)
 {
     if (str.Length == 1)
     {
         return(getWubiCode(str[0]));
     }
     if (str.Length == 2)
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         return(code1.Substring(0, 2) + code2.Substring(0, 2));
     }
     if (str.Length == 3)
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         string code3 = getWubiCode(str[2]);
         return(code1[0].ToString() + code2[0].ToString() + code3.Substring(0, 2));
     }
     else
     {
         string code1 = getWubiCode(str[0]);
         string code2 = getWubiCode(str[1]);
         string code3 = getWubiCode(str[2]);
         string code4 = getWubiCode(str[str.Length - 1]);
         return(code1[0].ToString() + code2[0] + code3[0] + code4[0]);
     }
 }