ableToFormat = true;
isExpectingCountryCallingCode = false;
possibleFormats.clear();
+ lastMatchPosition = 0;
+ formattingTemplate.setLength(0);
+ currentFormattingPattern = "";
return attemptToChooseFormattingPattern();
}
}
private String inputDigitHelper(char nextChar) {
+ // Note that formattingTemplate is not guaranteed to have a value, it could be empty, e.g.
+ // when the next digit is entered after extracting an IDD or NDD.
Matcher digitMatcher = DIGIT_PATTERN.matcher(formattingTemplate);
if (digitMatcher.find(lastMatchPosition)) {
String tempTemplate = digitMatcher.replaceFirst(Character.toString(nextChar));