コード例 #1
0
ファイル: WebIndex.cs プロジェクト: DragonZX/chmprocessor
        static public ArrayList NormalizeWordsSet(string[] words)
        {
            ArrayList normalizedWord = new ArrayList();

            foreach (string word in words)
            {
                string n = WebIndex.Normalize(word);
                if (!n.Equals(""))
                {
                    normalizedWord.Add(n);
                }
            }
            return(normalizedWord);
        }
コード例 #2
0
ファイル: Result.cs プロジェクト: DragonZX/chmprocessor
        static private string BoldSearchedWords(string showText, SearchWords searchWords)
        {
            string result = "";

            bool   atWord           = false;
            string currentWord      = "";
            string currentOutOfWord = "";
            int    count            = showText.Length;

            for (int i = 0; i < count; i++)
            {
                char c = WebIndex.Normalize(showText[i]);
                if (WebIndex.GoodChar(c))
                {
                    if (!atWord)
                    {
                        currentWord = "";
                        atWord      = true;
                        result     += HttpUtility.HtmlEncode(currentOutOfWord);
                    }
                    currentWord += c;
                }
                else
                {
                    if (atWord)
                    {
                        currentOutOfWord = "";
                        atWord           = false;
                        result          += FormatSearchWord(currentWord, searchWords);
                    }
                    currentOutOfWord += c;
                }
            }
            if (atWord)
            {
                result += FormatSearchWord(currentWord, searchWords);
            }
            else
            {
                result += HttpUtility.HtmlEncode(currentOutOfWord);
            }

            return(result);
        }