c# - Currency Format Returns Invalid Characters in Azure -
i have double amount 5190.40, when convert "swiss franc" gives 5'190.40. however, when deploy changes azure, not convert correctly. converted currency 5Â 190.40, incorrect. culture name german (switzerland).
i using following code convert currency
internal static string formatcurrency(this double amount, string currencycode) { var culture = (from c in cultureinfo.getcultures(culturetypes.specificcultures) let r = new regioninfo(c.lcid) r != null && r.isocurrencysymbol.toupper() == currencycode.toupper() select c).firstordefault(); if (culture == null) return amount.tostring("0.00"); culture.numberformat.currencysymbol = string.empty; return string.format(culture, "{0:c}", amount).trim(); }
i executing code in following manner:
double amount = 5190.40; amount.formatcurrency("chf");
Comments
Post a Comment