Browse Source

Add comment

Follow up from change 49c2427, copying the comment from the Java implementation to the C++ impl.
pull/615/head
Andy Staudacher 11 years ago
parent
commit
8d21a36506
2 changed files with 4 additions and 0 deletions
  1. +2
    -0
      cpp/src/phonenumbers/asyoutypeformatter.cc
  2. +2
    -0
      javascript/i18n/phonenumbers/asyoutypeformatter.js

+ 2
- 0
cpp/src/phonenumbers/asyoutypeformatter.cc View File

@ -738,6 +738,8 @@ char AsYouTypeFormatter::NormalizeAndAccrueDigitsAndPlusSign(
void AsYouTypeFormatter::InputDigitHelper(char next_char, string* number) {
DCHECK(number);
number->clear();
// 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.
const char32 placeholder_codepoint = UnicodeString(kDigitPlaceholder)[0];
int placeholder_pos = formatting_template_
.tempSubString(last_match_position_).indexOf(placeholder_codepoint);


+ 2
- 0
javascript/i18n/phonenumbers/asyoutypeformatter.js View File

@ -1086,6 +1086,8 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.
i18n.phonenumbers.AsYouTypeFormatter.prototype.inputDigitHelper_ =
function(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.
/** @type {string} */
var formattingTemplate = this.formattingTemplate_.toString();
if (formattingTemplate.substring(this.lastMatchPosition_)


Loading…
Cancel
Save