getRememberedPosition method

int getRememberedPosition()

Returns the current position in the partially formatted phone number of the character which was previously passed in as the parameter of inputDigitAndRememberPosition.

Implementation

int getRememberedPosition() {
  if (!_ableToFormat) {
    return _originalPosition;
  }

  int accruedInputIndex = 0;
  int currentOutputIndex = 0;

  while (accruedInputIndex < _positionToRemember &&
      currentOutputIndex < _currentOutput.length) {
    if (_accruedInputWithoutFormatting.toString()[accruedInputIndex] ==
        _currentOutput[currentOutputIndex]) {
      accruedInputIndex++;
    }
    currentOutputIndex++;
  }
  return currentOutputIndex;
}