public static int Search4(string txt, string[][] refs, bool allowPartofWord, int length)
        {
            if (txt == null)
            {
                return(0);
            }
            var note = 0;

            Parallel.ForEach(refs, (refgroup) =>
            {
                var pref = refgroup[0].Substring(0, length);
                int pos  = txt.IndexOf(pref, StringComparison.InvariantCultureIgnoreCase);

                while (pos > -1)
                {
                    foreach (string s in refgroup)
                    {
                        var co = length;

                        while (pos + co < txt.Length &&
                               co < s.Length && (
                                   txt[pos + co] == s[co] ||                         //same caracter
                                   txt[pos + co] + 32 == s[co] ||
                                   SearchTools.includeAccent(txt[pos + co], s[co]))) //include different casse
                        {
                            co++;
                        }

                        if (co == s.Length)
                        {
                            bool isWord =
                                (pos == 0 || SearchTools.isWordSep(txt[pos - 1]) &&
                                 (pos + s.Length >= txt.Length || SearchTools.isWordSep(txt[pos + s.Length])));
                            if (isWord || allowPartofWord)
                            {
                                note += s.Length;
                            }
                            break;
                        }
                    }

                    if (pos + 1 >= txt.Length)
                    {
                        break;
                    }
                    pos = txt.IndexOf(pref, pos + 1, StringComparison.InvariantCultureIgnoreCase);
                }
            });

            return(note);
        }
        /// <summary>
        /// Search for a list of string in a text
        /// sample test 16.6763 second
        /// </summary>
        /// <param name="txt">text</param>
        /// <param name="refs">array of string to search (grouped by first letter)</param>
        /// <param name="allowPartofWord">if set allow word or part of word match</param>
        /// <param name="length">number of character to use in group</param>
        /// <param name="result">result list</param>
        /// <returns></returns>
        public static void Search4(string txt, string[][] refs, bool allowPartofWord, int length, List <SearchResult> result)
        {
            Parallel.ForEach(refs, (refgroup) =>
            {
                var pref = refgroup[0].Substring(0, length);
                int pos  = txt.IndexOf(pref, StringComparison.InvariantCultureIgnoreCase);

                while (pos > -1)
                {
                    foreach (string s in refgroup)
                    {
                        var co = length;

                        while (pos + co < txt.Length &&
                               co < s.Length && (
                                   txt[pos + co] == s[co] ||                         //same caracter
                                   txt[pos + co] + 32 == s[co] ||
                                   SearchTools.includeAccent(txt[pos + co], s[co]))) //include different casse
                        {
                            co++;
                        }

                        if (co == s.Length)
                        {
                            bool isWord =
                                (pos == 0 || SearchTools.isWordSep(txt[pos - 1]) &&
                                 (pos + s.Length > txt.Length || SearchTools.isWordSep(txt[pos + s.Length])));
                            if (isWord || allowPartofWord)
                            {
                                result.Add(new SearchResult
                                {
                                    Word         = s,
                                    NearNumber   = pos > 2 && SearchTools.isNumber(txt[pos - 2]),
                                    isPartOfWord = !isWord,
                                    Position     = pos
                                });
                            }

                            break;
                        }
                    }

                    if (pos + 1 >= txt.Length)
                    {
                        break;
                    }
                    pos = txt.IndexOf(pref, pos + 1, StringComparison.InvariantCultureIgnoreCase);
                }
            });
        }