Class Index | File Index

Classes


Class PhoneFmt

Create a new phone number formatter object that formats numbers according to the parameters.

The options object can contain zero or more of the following parameters:

Some regions have more than one style of formatting, and the style parameter selects which style the user prefers. An array of style names that this locale supports can be found by calling PhoneFmt.getAvailableStyles. Example phone numbers can be retrieved for each style by calling PhoneFmt.getStyleExample.

If the MCC is given, numbers will be formatted in the manner of the country specified by the MCC. If it is not given, but the locale is, the manner of the country in the locale will be used. If neither the locale or MCC are not given, then the country of the current ilib locale is used.
Defined in: ilib-full-dyn.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
PhoneFmt(options)
Method Summary
Method Attributes Method Name and Description
 
format(number, options)
Format the parts of a phone number appropriately according to the settings in this formatter instance.
 
Return an array of names of all available styles that can be used with the current formatter.
 
Return an example phone number formatted with the given style.
Class Detail
PhoneFmt(options)
Parameters:
{Object} options
properties that control how this formatter behaves
Method Detail
{string} format(number, options)
Format the parts of a phone number appropriately according to the settings in this formatter instance. The options can contain zero or more of these properties: The partial parameter specifies whether or not the phone number contains a partial phone number or if it is a whole phone number. A partial number is usually a number as the user is entering it with a dial pad. The reason is that certain types of phone numbers should be formatted differently depending on whether or not it represents a whole number. Specifically, SMS short codes are formatted differently.

Example: a subscriber number of "48773" in the US would get formatted as:

Any place in the UI where the user types in phone numbers, such as the keypad in the phone app, should pass in partial: true to this formatting routine. All other places, such as the call log in the phone app, should pass in partial: false, or leave the partial flag out of the parameters entirely.
Parameters:
{!PhoneNumber} number
object containing the phone number to format
{{ partial:boolean|style:string|mcc:string|locale:(string|Locale)|sync:boolean|loadParams:Object|onLoad:function(string) }} options
Parameters which control how to format the number
Returns:
{string} Returns the formatted phone number as a string.

{Array.<string>} getAvailableStyles()
Return an array of names of all available styles that can be used with the current formatter.
Returns:
{Array.<string>} an array of names of styles that are supported by this formatter

{string|undefined} getStyleExample(style)
Return an example phone number formatted with the given style.
Parameters:
{string|undefined} style
style to get an example of, or undefined to use the current default style for this formatter
Returns:
{string|undefined} an example phone number formatted according to the given style, or undefined if the style is not recognized or does not have an example

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Feb 02 2016 15:53:55 GMT-0800 (PST)