示例#1
0
        static void Main()
        {
            string _keyWord = "hey";

            byte[] _byteKeyWord = Encoding.ASCII.GetBytes(_keyWord);
            string _context     = "Lo hey hey rem ipsum dolor sit amet, consectetur adipiscing elit. Fusce et varius nisi";

            byte[]     _byteContext = Encoding.ASCII.GetBytes(_context);
            BoyerMoore boyerMoore   = new BoyerMoore()
                                      .SetPattern(_byteKeyWord)
                                      .SetSearchArray(_byteContext);
            List <int> _findList = boyerMoore.SearchAll();

            Console.WriteLine("Points of entitites:");
            foreach (var item in _findList)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("Number of find words: " + boyerMoore.count());
            Console.WriteLine("Long random prime: " + longRandomPrime());
        }