The
Phone Number Utility is part of the Symbian Text Utility Component (etul.dll
)
and it offers methods for parsing and validating phone numbers.
Examples of valid phone numbers:
Even though both of the above examples are valid phone numbers, only the first one is accepted as a phone number by many systems. To convert the second number to the first number, parsing methods of Phone Number Utility can be used.
The TulPhoneNumberUtils class implements the static methods that make up the interface.
Phone Number
Utility can be accessed through the TulPhoneNumberUtils class
that is defined in the header tulphonenumberutils.h
. This
utility is linked to the etul.lib
library.
Method Information
The enumerated type TPhoneNumberType is used to specify the type of phone number for some of the methods below.
Method name | Details |
---|---|
|
Removes irrelevant characters and white space from the supplied
phone number. Allowed characters are determined by phone number type, in other
words, the |
|
Checks if the supplied phone number is a valid phone number of the supplied type. |
|
Checks if the supplied phone number is a valid phone number. The
phone number is valid if it contains only characters specified by the parameter |
|
Removes the specified invalid characters from the supplied phone number string. |
Example
The following example shows how to use
the TulPhoneNumberUtils
class parsing methods:
TBuf<50> number = _L("+358 (40) 123 132"); TBool validNumber = TulPhoneNumberUtils::ParsePhoneNumber(number, TulPhoneNumberUtils::EPlainPhoneNumber ); // validNumber == ETrue; // number == "+35840123132" SendSMS(number) // etc.. // OR TBuf<50> number = _L("+358 (40) 123p132"); // note 'p' TBool validNumber = TulPhoneNumberUtils::ParsePhoneNumber(number, TulPhoneNumberUtils::EPlainPhoneNumber ); // validNumber == EFalse; // number == "+358 (40) 123p132" // unchanged
For more information on individual methods, please see the reference API for TulPhoneNumberUtils