显示电话号码在asp.net不同的国家格式。使用的语言环境 [英] Display Phone Number In Different Country format in asp.net. using locale

查看:153
本文介绍了显示电话号码在asp.net不同的国家格式。使用的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从用户数量上接受并指出错误的国家形式显示出来。

I want to accept on number from user and display it in diffrent country format.

像前:9080898909这inputed号
在loacal国家格式显示(任意)
908,089,890,9

like ex: 9080898909 this in inputed number and displays in loacal country format(any) 908,089,890,9

90.808.989.09

90.808.989.09

9080,8989,09

9080,8989,09

90,808,989,09

90,808,989,09

疗法是本地化和globlelization的概念,你能告诉我怎么才达到的..?

ther is concept of localization and globlelization, can you tell me how to achive that..?

推荐答案

存储在您的资源数字格式不同的国家,然后用它根据 CultureInfo.Current

Store in your resources number formats for different countries and then use it depending on CultureInfo.Current.

如何申请的电话号码格式,你可以在这里阅读:格式化C#中的电话号码,最快的方法?

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);

在这种情况下,您需要将您的数字phne资源存储,如:

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

或者,如果你使用的是本地化,只是把的电话号码格式为每个文化资源文件。

这篇关于显示电话号码在asp.net不同的国家格式。使用的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆