Beispiel #1
0
        public static void ReadValues(long lineNumber, ReadOnlySpan <byte> line, Encoding encoding, byte[] separator,
                                      NewValueAsSpan newValue)
        {
            var position = 0;

            while (true)
            {
                var next = line.IndexOf(separator);
                if (next == -1)
                {
                    newValue?.Invoke(lineNumber, position, line, encoding);
                    break;
                }

                newValue?.Invoke(lineNumber, position, line.Slice(0, next), encoding);
                line      = line.Slice(next + separator.Length);
                position += next + separator.Length;
            }
        }