Пример #1
0
        /// <summary>
        /// Convert UTF8 numeric digits to an integer.  Negative integers are not supported.
        /// Input format: 1234
        /// </summary>
        public int ParseInt()
        {
            int  begin = offset;
            int  end   = offset;
            byte b;

            // Skip to end of integer.
            while (offset < length)
            {
                b = buffer[offset];

                if (b < 48 || b > 57)
                {
                    end = offset;
                    break;
                }
                offset++;
            }

            // Convert digits into an integer.
            return((int)ByteUtil.Utf8DigitsToInt(buffer, begin, end));
        }