Can I format a telephone number as per current culture? For example, to format price as per culture, I use this:
public object Convert(object value, Type targetType, object para, System.Globalization.CultureInfo culture)
{
string currency = value.ToString();
if (!string.IsNullOrEmpty(currency) && !string.IsNullOrWhiteSpace(currency))
{
Int64 C;
bool result = Int64.TryParse(currency, out C);
if (result)
{
currency = "Price: " + C.ToString("C", culture);
}
}
return currency;
}
This will show my price depending on culture (For es-ES culture -> Price: $5 if value = 5). Is there a way to do something similar for a telephone number?
I don't believe there is a built-in way to display localized phone numbers, but a very similar question on Stack Overflow provided a solution concept that should work for you. See here: Display Phone Number In Different Country format in asp.net. using locale
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.