开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜