Exemple #1
0
        internal void SubtractFromString(Range range)
        {
            var firstPart = "";
            var lastPart = "";

            if (range.Start > 0 && range.Start <= _text.Length)
            {
                firstPart = _text.Substring(0, range.Start);
            }
            if (range.End >= 0 && range.End < _text.Length)
            {
                lastPart = _text.Substring(range.End, _text.Length);
            }
            _text = firstPart + lastPart;
        }
        private Range calculateRange(int start, int end)
        {
            var range = new Range();
            for (int i = start; i <= end && i < Mask.Length; i++)
            {
                if (_maskToRaw[i] != -1)
                {
                    if (range.Start == -1)
                    {
                        range.Start = _maskToRaw[i];
                    }

                    range.End = _maskToRaw[i];
                }
            }
            if (end == Mask.Length)
            {
                range.End = _rawText.Length;
            }
            if (range.Start == range.End && start < end)
            {
                int newStart = PreviousValidPosition(range.Start - 1);
                if (newStart < range.Start)
                {
                    range.Start = newStart;
                }
            }
            return range;
        }