コード例 #1
0
 public void addLetter()
 {
     foreach (var letter in enteredText)
     {
         if (!LZWArray.ContainsKey(letter + ""))
         {
             index++;
             LZWArray.Add(letter + "", index);
         }
     }
 }
コード例 #2
0
        public bool addToArray(string preStr)
        {
            string str = "";

            if (preStr.Length > 1)
            {
                str = preStr.Substring(0, preStr.Length - 1);
            }
            else
            {
                str = preStr;
            }

            if (!checkInArray(str))
            {
                index++;
                LZWArray.Add(str, index);
                return(true);
            }
            else
            {
                return(false);
            }
        }