Formating a phone number based on locale

How can I format a phone number based on the region setting? E.g. phone numbers will be formated as (xxx) xxx-xxxx if the region is set to US. And formatted otherwise if the region is set to some other country.

also want to know

Similar Messages

  • Format a Phone number using StringFormat in xaml

    Hello,
    I am looking to format a Phone Number in xaml. The Phone Number comes as a string to me.
    <Label Content="{Binding SelectedPatientPolicy.CarrierPhoneNumber}" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Style="{StaticResource FieldValueStyle}"/>
    Here I want to apply StringFormat as "(###) ###-####".
    Please let me know how can i achieve this.
    Thanks,
    Abdi

    You cannot apply a StringFormat on a string value in XAML. But you could use a converter class:
    namespace WpfApplication24_4
    public class StringToPhoneConverter : IValueConverter
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    string s = value as string;
    if (string.IsNullOrEmpty(s) || s.Length < 10)
    return value;
    return string.Format("({0}) {1}-{2}", s.Substring(0,3), s.Substring(3,3), s.Substring(6,4)); //"(###) ###-####".
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    throw new NotImplementedException();
    <Window x:Class="WpfApplication24_4.Window5"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication24_4"
    Title="Window5" Height="300" Width="300">
    <Window.Resources>
    <local:StringToPhoneConverter x:Key="conv"/>
    </Window.Resources>
    <Grid>
    <Label Content="{Binding SelectedPatientPolicy.CarrierPhoneNumber, Converter={StaticResource conv}}" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" Style="{StaticResource FieldValueStyle}"/>
    </Grid>
    </Window>
    The other option is to format the value of the source property directly. You cannot do this in the XAML markup anyway.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • E72 - How to format the phone number on contact

    I can't figure out a easy for formatting my contact number to be like (xxx) xxx-xxxx or xxx-xxx-xxxx on e72 instead going to outlook make the changes and re-sync again. I find xxxxxxxxxx hard to read. I thought I found out how to add hypen "ctrl+(" but that basically long dash rather than short dash which you get an error if you try to send message with the phone number having the long dash. It is fine when you call. It is smart enough to strip out non-numerical value. But it is sms is not smart enough to remove it.

    ozidug wrote:
    The sad thing is that there is an international standard for phone numbers (+xxx) xxx-xxxx which everyone ought to recognise and use. It allows localisation and shortened dialling, but Nokia just want a number string. It's just lazy on thepart of the programmers; since it's a standard, they should have developed the program code once and just inserted it into every phone they produce, and that's not hard.
    A poor reflection on Nokia, I'm sad to say.
    AFAIK the international standard for telephone numbers (E.164) does not say anything about using spaces, dashes, or brackets in a telephone number.
    This may of course make it more "human readable", but claiming that what you want is a standard doesn't make it a standard, and I don't think Nokia (or any other phone manufacturer) should/could implement every single user-specific wish...

  • Generic funtction  return  format string Phone Number

    Hi
    I tried , tried but nothing
    I need build a Generic Function formating phone number, passing Type Telephone (Res,Cml,Cel...etc wiht 3 letters ) , Prefix can to have 3 or 4 digits and Sufix wih 4 digits
    How Can I to do It ?
    where can I to find tutorial about Regular Expression
    thank

    Asking the same question again?
    Re: Function that to Format
    Look in the documentation for regular expressions (it's not difficult to search you know!)
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm#ADFNS1003

  • Ringtone format & Contact phone number transfer from another phone

    Two questions for one of the experts.
    What format are Iphone ringtones? Can you use songs previously purchased and converted to the proper format be used as a ring tone and how would someone perform this action.
    Is it possible to "bluetooth" phone number from old cell phone to the Iphone?

    What format are Iphone ringtones? Can you use songs previously purchased and converted to the proper format be used as a ring tone and how would someone perform this action.
    M4r - which is MP4 and no - not without a hack.
    Is it possible to "bluetooth" phone number from old cell phone to the Iphone?
    No - the iPhone does not support Bluetooth data transfer. All data syncing is done with a USB connection with your computer via iTunes.

  • Why does iCal insist on formatting a phone number as a hyperlink? How can I prevent this, and prevent iCal from launching FaceTime in response to entering the phone number in the event box?

    I just want to enter a phone number into an event in iCal. I do not want to launch FaceTime. How can I just put a phone number in an iCal event, without OSX 10.10 insisting on launching FaceTime in response to entering the phone number? I use a Macbook Pro.

    Megantic wrote:
    Ever since I upgraded my iPhone 4S to iOS7, it has basically become a brick.  It constantly freezes, and the home button becomes completely inoperable.  People have suggested a number of fixes for the home button problem ("calibrating", tightening screws, etc.) but none of the fixes solved the problem.  Through trial and error, I've come to realize that the problem is that the phone doesn't have enough computing power and that too much of its RAM gets used up by background processes, causing the phone to freeze.
    I have found an app that stops unnecessary background processes currently running, frees up RAM, and lets the phone function properly (Free RAM 1.3). Once I've run this app, the phone functions perfectly.
    However, this clean up only happens each time the app is launched (ie: it does not continuously free up RAM).  So, I constantly have to run it (and sometimes am not able to because the phone is frozen and the home button won't work).
    When it is running, the app  displays the background processes that are running.  Looking at the list, there are many processes for which I have no need, such as processes related to automatic checking for app updates, processes related to iCloud (which I do not use), etc.  Preventing these processes from running in the first place would go a long way in making my phone more useable (being able to return to a previous iOS would be a better option, but Apple won't allow this).
    Here is my question:  is there a way to prevent unnecessary background processes from running at all?
    Which app is this?

  • Import phone number

    Dear community,
    I am trying to import data regarding account and lead and I have some problems regarding phone number format. Although in the csv file I formatted the phone number based on the documentation +country code followed by space but after the import process all the phone numbers have a prefixed like 011.
    Could anyone to provide a solution workaround for this issue?
    Thank in advance,
    Cristian

    Based on the selected Country the following is the correct format for importing phone numbers:
    Non-US & Canadian Phone Format (+33 01 40359564)
    US & Canadian Phone Format
    408-555-1234
    (408) 555-1234

  • Registration says "invalid local phone number" after OS 10.3x restore

    I have an old PowerBook G4 that's still in great shape and I wanted to restore it for some limited usage. The restore went without a hitch, but now OS X is prompting me to register the computer. When I enter my phone number, I get this pop-up window:
    "The local phone number you entered is not valid.
    Exchange number must be greater than 200, and cannot be 411, 611 or 911."
    Any thoughts on this? I really don't need to register this computer as it will mainly be used for internet browsing.
    I've already got an Apple ID for my newer Macs.
    Any help to either bypass registration or correctly formatting the phone number would be appreciated, thanks!

    command-Q gets you off the registration screen.

  • Custom field to format phone number?

    Is it possible to create a custom field for a list item to format a phone number (e.g. take 555-555-5555 and format it to (555) 555-5555)?  Does anyone have any examples?

    Hi,
    If you want to format the phone number to (555)555-5555, you can create a calculated column base on the phone number column and set its formula as” ="("&REPLACE([phone number],4,1,")")” .
    For more information about formula, please refer to: http://office.microsoft.com/en-us/sharepointtechnology/CH100650061033.aspx
    Hope it can help you.
    Xue-Mei Chang

  • Phone number display format

    We are looking for a way to personalize the display format of phone number.
    I am at a company where there is a SAPphone or alike software connection to auto-dail using the SAP screen. Other then most companies here this is done from ECC rather then from CRM.
    For this, the Phone numbers are stored flat, without spaces, hashes and the like.
    In SAP there are setting for how to display date and numbers. I did not yet find a way to do the same with phonenumbers. There is an international requirement on how to display the numbers, and storing these numbers formatted is in my opinion not the preferred way to do it.
    There are function modules to format the numbers from flat stored numbers, but that will mean cloning standard transactions to Z versions so that the FM can be used. I would rather not do this too.
    Anyone any ideas?

    I am having the same issue with My Treo 700.  Did anyone find a resolution to this problem.  I think it is more than annoying.  For no reason the formatting just changed. 
    Thanks for you help.

  • Phone number formatting using personalization

    Hi,
    Is there any way that i can format the phone number in forms using personalization so that the user should only enter the phone number in 999-999-9999(only numbers) format or else it should throw an exception.
    Thanks in advance.
    PK

    Are you talking about the D2K forms or self service pages?
    --Shiv                                                                                                                                                                                           

  • Is there any way to turn off Contacts' automatical formating of phone numbers?

    Address Book's telephone fields used to be free text. You could format the phone number as desired and add comments if needed. Contacts automatically format phone number according to the ten-digit phone number (area code plus 7 digit number). If the content of a phone field does not conform to this format, the contents are all pushed together, removing any spaces that you may have entered.
    In many countries that required formating is inappropriate. Besides, it limits your freedom to add important details, like "Do not call after 7PM," etc.
    There seems no way to turn this automatical formating.

    The format for South African numbers is wrong!
    Contacts uses: +27 (xx) yyyyyyy
    Firstly the dialing code is no longer optional (for at least five years) so the brackets make no sense. Also, almost everyone uses the grouping of 3 digits then 4 digits - including official phone books.
    Its should be +27 xx yyy zzzz
    (I would also like the the auto-formatting to be optional as some other countries are crazy too).
    Is posting something here enough to get the attention of developers?

  • Change default phone number on BB Pearl 8110

    Hello,
    Where can I change the default phone number and any locale on my BB Pearl. I moved from Belgium to Qatar and it seems my phone still thinks he is in Belgium.
    - In the BBDesktop Software my phone number is still displayed as my former Belgian phone
    - when I dial a number in qatar I have to put international prefix
    thanks
    Paul
    BB fan

    Hello and welcome, 
    You want to do two things: 
    1- Change the Smart Dialing options
    On the Home screen, click the Options icon
    Click Phone Options 
    Click Smart Dialing
    Change the Country Code and the National Number Length to whatever it is for your country.  
    2- Change the Owner information 
    On the Home screen, click the Options icon.
    Click Owner.
    Type your contact information.
    Press the Menu key.
    Click Save.
    Cheers!

  • Need to have Phone Number field as just numbers with no formatting.

    We have a web service that is passed the work phone field from the contact object. That WS uses the phone number to auto-dial the customer's number for our sales reps.
    My issue is that the WS expects to just see the area code and the phone number as digits as 1235554444. It has been working fine for over a year and recently been failing as now the numbers come in with a "+" sign.
    The format seems to change depending on the time of day I look at the fields and is random for each user. The company profile is set to USA as the default and so are the user's locale settings.
    How do I make the "+" go away?
    I have tried various settings and couldn't seem to find one that didn't give me the formatting. I've also tried to copy the work phone field to a hidden field and using WF to strip out the "+" but there seems to be no way to do a REPLACE() function in a WF rule.
    Any ideas?

    So after spending enough time with this I was able to find a way around the issue. Ultimately I needed a phone number format that was fixed and would not mask the data per the user's locale settings. It also needed to be just area code and phone number shown as 1112223333.
    On the contact object, a new field was created as a Short Text. Then a WorkFlow as created that copies over the value from the WorkPhone field into this unformatted number so that it can be passed to our Web Service.
    It took a while for me to figure this out since if you just use the WorkPhone variable you get all the masking based on locale. I didn't have the functions available to me in the WorkFlow to just strip spaces and "+" or "( )" so I needed it to be as close as I coudl to just a basic phone number. By using the FieldValue() function it seemed to take a number like 1 (555) 444-4444 and return 1 555 4444444. This works no matter if it was +1 555 4444444 or +41 555 4444444 so I could then use some pattern logic.
    This is what I used to copy that data over to my temp/work field which is now passed to our click-to-dial function.
    Mid(FieldValue('<WorkPhone>'), InStr(FieldValue('<WorkPhone>'),' ') + 1,3) + Right(FieldValue('<WorkPhone>'),7)

  • Phone number format in Mountain Lion

    My old Address Book (prior to Mountain Lion's change to Contacts) had hundreds of phone numbers wirth the preference that they would NOT be auto formatted --- I entered the numbers just as I wanted them to appear. Now, after updating to Mountain Lion, all my phone numbers ar formatted the SAME (U.S. convention with use of parenthesis) which is not what I want. Anyone know of a workaround (or will Apple correct this with an update?).

    D. Hoffmann wrote:
    Apple's software engineers probably all live in the greater San Francisco are, where there aren't any area code overlays, which would potentially explain why they didn't think to allow xxx-xxx-xxxx as an alternative format.
    I think the explanation is that they all have cell phones. Apple expects everyone to be in the habit of prefixing all phone numbers with "+<country code>". If you do that, your cell phone will be smart enough to figure out how many digits it needs to dial. Land lines can't do that. Here in Ontario, things are pretty antiquated, If I dial a 905 number, it may or may not be local. I can't tell until I try. If I don't add the 1, I'll be chastised for attempting to make a long distance call without the 1 and get hung up on. If I just add the one and don't need it, I'll be chastised for that too and hung up on.
    So, if you create a phone number in Contacts with "+1", you get a US-style number useable anywhere in the world from a cell phone. If you prefix with a "+33", you get a French-style number useable from anywhere on a cell phone. Apple doesn't do hybrids because that assumes you are dialing the number by hand and no one does that anymore.

Maybe you are looking for