我可以按照当前文化格式化电话号码吗?例如,要根据文化格式化价格,我使用这个:
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;
}
这将根据文化显示我的价格(对于 es-ES 文化 -> 价格:如果值 = 5,则为 5 美元)。有没有办法为电话号码做类似的事情?