Python: module phonenumbers.asyoutypeformatter

phonenumbers.asyoutypeformatter | index phonenumbers/asyoutypeformatter.py

`A formatter which formats phone numbers as they are entered.
An AsYouTypeFormatter can be created by invoking
AsYouTypeFormatter(region_code). After that digits can be added by invoking
input_digit() on the formatter instance, and the partially formatted phone
number will be returned each time a digit is added. clear() should be invoked
before a new number needs to be formatted.
See the unit tests for more details on how the formatter is to be used.`

Modules
`` |  |
re |  |  |

Classes
`` |  | builtins.object AsYouTypeFormatter
class AsYouTypeFormatter(builtins.object)
`` | `AsYouTypeFormatter(region_code)`
| Methods defined here: __init__(self, region_code) `Gets an AsYouTypeFormatter for the specific region. Arguments: region_code -- The region where the phone number is being entered Return an AsYouTypeFormatter object, which could be used to format phone numbers in the specific region "as you type"` clear(self) `Clears the internal state of the formatter, so it can be reused.` get_remembered_position(self) `Returns the current position in the partially formatted phone number of the character which was previously passed in as the parameter of input_digit(remember_position=True).` input_digit(self, next_char, remember_position=False) `Formats a phone number on-the-fly as each digit is entered. If remember_position is set, remembers the position where next_char is inserted, so that it can be retrieved later by using get_remembered_position. The remembered position will be automatically adjusted if additional formatting characters are later inserted/removed in front of next_char. Arguments: next_char -- The most recently entered digit of a phone number. Formatting characters are allowed, but as soon as they are encountered this method formats the number as entered and not "as you type" anymore. Full width digits and Arabic-indic digits are allowed, and will be shown as they are. remember_position -- Whether to track the position where next_char is inserted. Returns the partially formatted phone number.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Data
`` |  | REGION_CODE_FOR_NON_GEO_ENTITY = '001' U_EMPTY_STRING = '' U_SPACE = ' '