cpp/src/phonenumbers/phonenumberutil.cc
// A helper function to set the values related to leading zeros in a
// PhoneNumber.
A helper function to set the values related to leading zeros in a
PhoneNumber.
A helper function to set the values related to leading zeros in a PhoneNumber .
void PhoneNumberUtil::SetItalianLeadingZerosForPhoneNumber(
    const string& national_number, PhoneNumber* phone_number) const {
  if (national_number.length() > 1 && national_number[0] == '0') {
    phone_number->set_italian_leading_zero(true);
    size_t number_of_leading_zeros = 1;
    while (number_of_leading_zeros < national_number.length() - 1 &&
        national_number[number_of_leading_zeros] == '0') {
      number_of_leading_zeros++;
    }
    if (number_of_leading_zeros != 1) {
      phone_number->set_number_of_leading_zeros(static_cast<int32_t>(number_of_leading_zeros));
    }
  }
}
void PhoneNumberUtil :: SetItalianLeadingZerosForPhoneNumber ( const string & national_number , PhoneNumber * phone_number ) const { if ( national_number . length ( ) > 1 && national_number [ 0 ] == ' ' ) { phone_number -> set_italian_leading_zero ( true ) ; size_t number_of_leading_zeros = 1 ; while ( number_of_leading_zeros < national_number . length ( ) - 1 && national_number [ number_of_leading_zeros ] == ' ' ) { number_of_leading_zeros ++ ; } if ( number_of_leading_zeros != 1 ) { phone_number -> set_number_of_leading_zeros ( static_cast < int32_t > ( number_of_leading_zeros ) ) ; } } }
A helper function to set the values related to leading zeros in a
PhoneNumber.
A helper function to set the values related to leading zeros in a PhoneNumber .
// Note that if the national number is all "0"s, the last "0" is not // counted as a leading zero.