Display Phone Number In Different Country format in asp.net. using locale
I want to accept on number from user and displa开发者_运维问答y it in diffrent country format.
like ex: 9080898909 this in inputed number and displays in loacal country format(any) 908,089,890,9
90.808.989.09
9080,8989,09
90,808,989,09
ther is concept of localization and globlelization, can you tell me how to achive that..?
Store in your resources number formats for different countries and then use it depending on CultureInfo.Current
.
How to apply phone number format you can read here: Fastest way to format a phone number in C#?
string currentCulturePhoneFormat = Resources.ResourceManager.GetString("phone-format-" + System.Globalization.CultureInfo.CurrentCulture.Name);
lblPhone.Text = String.Format(currentCulturePhoneFormat, myEntity.PhoneNumber);
in this case you need to store your phne numbers in resources like:
phone-format-en-US // for USA
phone-format-de-DE // for Germany
phone-format-fr-FR // for France
Or if you are using localizations, just put phone-number-format
in resource file for each culture.
精彩评论