コード例 #1
0
        public List <string> Filter(string input, string filterInput)
        {
            var start   = DateTime.Now;
            var filters = new List <string>();

            try
            {
                var inputArray = input.Split('\n');
                foreach (var filter in filterInput.Split('\n'))
                {
                    filters.Add(filter.ToLower());
                }

                foreach (string filter in filters)
                {
                    if (inputArray.Any(s => s.ToLower().Contains(filter)))
                    {
                        Filtered.AddRange(
                            inputArray.Where(s => s.Contains(filter))
                            );
                    }
                }
            }
            catch (Exception e)
            {
                Error = e.Message;
            }
            Filtered.Sort();
            Filtered = Filtered.Distinct().ToList();
            Duration = (DateTime.Now - start).TotalSeconds;
            return(Filtered);
        }