Ejemplo n.º 1
0
        private void TrimEnd(ValueBuilder value, char[] buffer, int start, int end)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (buffer == null)
            {
                throw new ArgumentNullException(nameof(buffer));
            }
            if (start < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(start));
            }
            if (end >= buffer.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(end));
            }

            for (int i = end; i >= start; i--)
            {
                if (!IsWhiteSpace(buffer[i]))
                {
                    value.Append(buffer, start, i - start + 1);
                    return;
                }
            }

            _valueBuilder.TrimEnd(IsWhiteSpace);
        }