Пример #1
0
        public (bool success, List <string> results, List <int> index) Search(string data, string searchingText)
        {
            var           ss      = new SortAlgorithms().SortAscending(searchingText);
            var           jh      = 0;
            bool          success = false;
            List <int>    index   = new List <int>();
            List <string> results = new List <string>();

            foreach (var s in ss)
            {
                int[] value = SearchString(data, s);
                foreach (var i in value)
                {
                    jh++;
                    if (!index.Contains(i))
                    {
                        index.Add(i);
                    }
                    if (!results.Contains(s))
                    {
                        results.Add(s);
                    }
                }
            }
            if (jh > 0)
            {
                success = true;
            }
            return(success, results, index);
        }
Пример #2
0
        public bool SearchFunction(object whatToSearchFor, Dictionary <object, List <object> > dictionary)
        {
            var  items = new SortAlgorithms().SortAscending(whatToSearchFor);
            var  size  = dictionary.Count();
            bool flag  = false;

            foreach (var key in dictionary)
            {
                var List = dictionary[key];
                for (int i = 0; i < items.Length; i++)
                {
                    if (List.Contains(items[i]))
                    {
                        flag = true;
                    }
                }
            }
            return(flag);
        }