예제 #1
0
 /// <summary>
 /// Formats a phone number in the specified format using client-defined formatting rules. Note that
 /// if the phone number has a country calling code of zero or an otherwise invalid country calling
 /// code, we cannot work out things like whether there should be a national prefix applied, or how
 /// to format extensions, so we return the national significant number with no formatting applied.
 /// </summary>
 /// <param name="numberFormat">the format the phone number should be formatted into</param>
 /// <param name="userDefinedFormats">formatting rules specified by clients</param>
 /// <returns>the formatted phone number</returns>
 public string FormatByPattern(libphonenumber.PhoneNumberUtil.PhoneNumberFormat numberFormat, IEnumerable <NumberFormat> userDefinedFormats)
 {
     java.util.List <_NumberFormat> tempUserDefinedFormats = new java.util.List <_NumberFormat>();
     foreach (var item in userDefinedFormats)
     {
         tempUserDefinedFormats.add(item);
     }
     return(_PhoneNumberUtil.getInstance().formatByPattern(_inner, (_PhoneNumberFormat)numberFormat, tempUserDefinedFormats));
 }
예제 #2
0
 /// <summary>
 /// Formats a phone number in the specified format using default rules. Note that this does not
 /// promise to produce a phone number that the user can dial from where they are - although we do
 /// format in either 'national' or 'international' format depending on what the client asks for, we
 /// do not currently support a more abbreviated format, such as for users in the same "area" who
 /// could potentially dial the number without area code. Note that if the phone number has a
 /// country calling code of 0 or an otherwise invalid country calling code, we cannot work out
 /// which formatting rules to apply so we return the national significant number with no formatting
 /// applied.
 /// </summary>
 /// <param name="numberFormat">the format the phone number should be formatted into</param>
 /// <returns>the formatted phone number</returns>
 public string Format(libphonenumber.PhoneNumberUtil.PhoneNumberFormat numberFormat)
 {
     return(_PhoneNumberUtil.getInstance().format(_inner, (_PhoneNumberFormat)numberFormat));
 }