Ejemplo n.º 1
0
        int ParseInt(int start, int end, int radix, bool negative)
        {
            int max        = int.MinValue / radix;
            int result     = 0;
            int currOffset = start;

            while (currOffset < end)
            {
                int digit = CharUtil.Digit((char)(this.value[currOffset++ + this.offset]), radix);
                if (digit == -1)
                {
                    ThrowHelper.ThrowFormatException(this, start, end);
                }
                if (max > result)
                {
                    ThrowHelper.ThrowFormatException(this, start, end);
                }
                int next = result * radix - digit;
                if (next > result)
                {
                    ThrowHelper.ThrowFormatException(this, start, end);
                }
                result = next;
            }

            if (!negative)
            {
                result = -result;
                if (result < 0)
                {
                    ThrowHelper.ThrowFormatException(this, start, end);
                }
            }

            return(result);
        }
 public bool RegionMatchesIgnoreCase(int thisStart, ICharSequence seq, int start, int length) =>
 CharUtil.RegionMatchesIgnoreCase(this, thisStart, seq, start, length);
 public bool ContentEqualsIgnoreCase(ICharSequence other) => CharUtil.ContentEqualsIgnoreCase(this, other);
 public bool ContentEquals(ICharSequence other) => CharUtil.ContentEquals(this, other);
 public int IndexOf(char ch, int start = 0) => CharUtil.IndexOf(this, ch, start);
 public bool RegionMatches(int thisStart, ICharSequence seq, int start, int length) =>
 CharUtil.RegionMatches(this, this.offset + thisStart, seq, start, length);