diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-6501FAFF-6E21-5BC8-BA85-B1B4CE1AC6A7.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-6501FAFF-6E21-5BC8-BA85-B1B4CE1AC6A7.dita Fri Jun 11 12:39:03 2010 +0100 @@ -0,0 +1,88 @@ + + + + + +Phone +number utility overview +
Purpose

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:

    +
  • 1. +358501234567

  • +
  • 2. +358 (50) 123 4567

  • +

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.

+
Architectural +Relationships

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.

+
Description

Method +Information

The enumerated type TPhoneNumberType is +used to specify the type of phone number for some of the methods below.

+ + + +Method name +Details + + + + +

static TBool ParsePhoneNumber(TDes& aNumber, + TPhoneNumberType aType)

+

Removes irrelevant characters and white space from the supplied +phone number. Allowed characters are determined by phone number type, in other +words, the aType parameter. For example, parsing the number +358 +(40) 123 467 results in the number +35840123467.

+
+ +

static TBool IsValidPhoneNumber(const TDesC& aNumber, + TPhoneNumberType aType)

+

Checks if the supplied phone number is a valid phone number of the +supplied type.

+
+ +

TBool IsValidPhoneNumber(const TDesC& aNumber, const + TDesC& aValidChars)

+

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 aValidChars.

+
+ +

static void ParseInvalidChars(TDes& aNumber, const + TDesC& aInvalidChars)

+

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

+
\ No newline at end of file