/// <summary>
        /// Gets the index of the first occurrence of any element in the specified array.
        /// </summary>
        /// <param name="rope">The target rope.</param>
        /// <param name="anyOf">Array of characters being searched.</param>
        /// <param name="startIndex">Start index of the search.</param>
        /// <param name="length">Length of the area to search.</param>
        /// <returns>The first index where any character was found; or -1 if no occurrence was found.</returns>
        public static int IndexOfAny(this Rope <char> rope, char[] anyOf, int startIndex, int length)
        {
            if (rope == null)
            {
                throw new ArgumentNullException(nameof(rope));
            }
            if (anyOf == null)
            {
                throw new ArgumentNullException(nameof(anyOf));
            }
            rope.VerifyRange(startIndex, length);

            while (length > 0)
            {
                var    entry           = rope.FindNodeUsingCache(startIndex).PeekOrDefault();
                char[] contents        = entry.Node.Contents;
                int    startWithinNode = startIndex - entry.NodeStartIndex;
                int    nodeLength      = Math.Min(entry.Node.Length, startWithinNode + length);
                for (int i = startIndex - entry.NodeStartIndex; i < nodeLength; i++)
                {
                    char element = contents[i];
                    foreach (char needle in anyOf)
                    {
                        if (element == needle)
                        {
                            return(entry.NodeStartIndex + i);
                        }
                    }
                }
                length    -= nodeLength - startWithinNode;
                startIndex = entry.NodeStartIndex + nodeLength;
            }
            return(-1);
        }