/// <summary>
        /// Split to Lines
        /// </summary>
        /// <param name="source"></param>
        /// <param name="newLine"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static IEnumerable <string> SplitToLines(this string source,
                                                        NewLine newLine,
                                                        int count,
                                                        StringSplitOptions splitOptions)
        {
            if (string.IsNullOrEmpty(source))
            {
                yield break;
            }
            else if (count == 1)
            {
                yield return(source);

                yield break;
            }

            string delimiter = newLine.Delimiter();

            if (string.IsNullOrEmpty(delimiter))
            {
                foreach (string line in CoreSplitToLinesSmart(source, count, splitOptions))
                {
                    yield return(line);
                }

                yield break;
            }

            int position = 0;
            int index    = 0;

            while (true)
            {
                int next = source.IndexOf(delimiter, position);

                if (next < 0)
                {
                    break;
                }

                string item = source.Substring(position, next - position - delimiter.Length);

                position = next + delimiter.Length;

                if (splitOptions == StringSplitOptions.RemoveEmptyEntries && string.IsNullOrEmpty(item))
                {
                    continue;
                }

                index += 1;

                yield return(item);

                if (count > 0 && count - index <= 1)
                {
                    break;
                }
            }

            string tail = source.Substring(position);

            if (splitOptions != StringSplitOptions.RemoveEmptyEntries || !string.IsNullOrEmpty(tail))
            {
                yield return(tail);
            }
        }