internal SpanSplitEnumerator(ReadOnlySpan <T> span, T separator, bool removeEmptyEntries)
 {
     Current        = default;
     _sequence      = span;
     _separator     = separator;
     _spanSplitInfo = default(SpanSplitInfo) | (removeEmptyEntries ? SpanSplitInfo.RemoveEmptyEntries : 0);
 }
            /// <summary>
            /// Advances the enumerator to the next element in the <see cref="ReadOnlySpan{T}"/>.
            /// </summary>
            /// <returns>Returns whether there is another item in the enumerator.</returns>
            public bool MoveNext()
            {
                if (IsFinished)
                {
                    return(false);
                }

                do
                {
                    int index = _sequence.IndexOf(_separator);
                    if (index < 0)
                    {
                        Current         = _sequence;
                        _spanSplitInfo |= SpanSplitInfo.FinishedEnumeration;
                        return(!(ShouldRemoveEmptyEntries && Current.IsEmpty));
                    }

                    Current   = _sequence[..index];
        /// <summary>
        /// Advances the enumerator to the next element in the <see cref="ReadOnlySpan{T}"/>.
        /// </summary>
        /// <returns>Returns whether there is another item in the enumerator.</returns>
        public bool MoveNext()
        {
            if (IsFinished)
            {
                return(false);
            }

            do
            {
                int index = _sequence.IndexOf(_separator);
                if (index < 0)
                {
                    Current         = _sequence;
                    _spanSplitInfo |= SpanSplitInfo.FinishedEnumeration;
                    return(!(ShouldRemoveEmptyEntries && Current.IsEmpty));
                }

                Current   = _sequence.Slice(0, index);
                _sequence = _sequence.Slice(index + 1);
            } while (Current.IsEmpty && ShouldRemoveEmptyEntries);

            return(true);
        }