protected void Page_Load(object sender, EventArgs e)
{
string CurrencySymbols = "xof";
Response.Write(string.Format("{0:F" + getCurrencyDecimalPlaces(CurrencySymbols.ToUpper()) + "}", 12456.017312) + "
");
}
public static int getCurrencyDecimalPlaces(string CurrencySymbols)
{
Dictionary oCurrencyDictionary = new Dictionary();
#region Add Decimal
oCurrencyDictionary.Add("RUB", 2); //Russian Ruble
oCurrencyDictionary.Add("CHF", 2); //Swiss Franc
oCurrencyDictionary.Add("GBP", 2); //British Pound
oCurrencyDictionary.Add("EUR", 2); //Euro
oCurrencyDictionary.Add("USD", 2); //American Dollar
oCurrencyDictionary.Add("CAD", 2); //Canadian Dollar
oCurrencyDictionary.Add("INR", 2); //Indian Rupee
oCurrencyDictionary.Add("GHS", 2); //Ghana Cedi
oCurrencyDictionary.Add("NGN", 2); //Nigerian Naira
oCurrencyDictionary.Add("CNY", 2); //Chinese Yuan
oCurrencyDictionary.Add("BRL", 2); //Brazilian Real
oCurrencyDictionary.Add("HKD", 2); //Hong Kong Dollar
oCurrencyDictionary.Add("AED", 2); //UAE Dirham
oCurrencyDictionary.Add("JPY", 0); //Japanese Yen
oCurrencyDictionary.Add("XOF", 0); //CFA Franc (BCEAO)
oCurrencyDictionary.Add("XAF", 0); //CFA Franc (BEAC)
oCurrencyDictionary.Add("ARS", 2); //Argentine Peso
oCurrencyDictionary.Add("MXN", 2); //Mexican Peso
oCurrencyDictionary.Add("NPR", 2); //Nepalese Rupee
oCurrencyDictionary.Add("THB", 2); //Thai Baht
oCurrencyDictionary.Add("TRY", 2); //Turkish Lira
oCurrencyDictionary.Add("VEB", 2); //bolivar fuerte
oCurrencyDictionary.Add("VND", 2); //Vietnam Dong
oCurrencyDictionary.Add("UAH", 2); //Ukraine Hryvnia
oCurrencyDictionary.Add("SEK", 2); //Swedish Kronor
oCurrencyDictionary.Add("ZAR", 2); //South African Rand
oCurrencyDictionary.Add("PKR", 2); //Pakistani Rupee
oCurrencyDictionary.Add("PAB", 2); //Panama Balboa
oCurrencyDictionary.Add("NZD", 2); //New Zealand Dollar
oCurrencyDictionary.Add("MYR", 2); //Malaysian Ringgit
oCurrencyDictionary.Add("SGD", 2); //Singapore Dollar
oCurrencyDictionary.Add("BDT", 2); //Bangladeshi Taka
#endregion
if (oCurrencyDictionary.ContainsKey(CurrencySymbols))
{
return oCurrencyDictionary[CurrencySymbols];
}
else
{
return 2;
}
}
{
string CurrencySymbols = "xof";
Response.Write(string.Format("{0:F" + getCurrencyDecimalPlaces(CurrencySymbols.ToUpper()) + "}", 12456.017312) + "
");
}
public static int getCurrencyDecimalPlaces(string CurrencySymbols)
{
Dictionary
#region Add Decimal
oCurrencyDictionary.Add("RUB", 2); //Russian Ruble
oCurrencyDictionary.Add("CHF", 2); //Swiss Franc
oCurrencyDictionary.Add("GBP", 2); //British Pound
oCurrencyDictionary.Add("EUR", 2); //Euro
oCurrencyDictionary.Add("USD", 2); //American Dollar
oCurrencyDictionary.Add("CAD", 2); //Canadian Dollar
oCurrencyDictionary.Add("INR", 2); //Indian Rupee
oCurrencyDictionary.Add("GHS", 2); //Ghana Cedi
oCurrencyDictionary.Add("NGN", 2); //Nigerian Naira
oCurrencyDictionary.Add("CNY", 2); //Chinese Yuan
oCurrencyDictionary.Add("BRL", 2); //Brazilian Real
oCurrencyDictionary.Add("HKD", 2); //Hong Kong Dollar
oCurrencyDictionary.Add("AED", 2); //UAE Dirham
oCurrencyDictionary.Add("JPY", 0); //Japanese Yen
oCurrencyDictionary.Add("XOF", 0); //CFA Franc (BCEAO)
oCurrencyDictionary.Add("XAF", 0); //CFA Franc (BEAC)
oCurrencyDictionary.Add("ARS", 2); //Argentine Peso
oCurrencyDictionary.Add("MXN", 2); //Mexican Peso
oCurrencyDictionary.Add("NPR", 2); //Nepalese Rupee
oCurrencyDictionary.Add("THB", 2); //Thai Baht
oCurrencyDictionary.Add("TRY", 2); //Turkish Lira
oCurrencyDictionary.Add("VEB", 2); //bolivar fuerte
oCurrencyDictionary.Add("VND", 2); //Vietnam Dong
oCurrencyDictionary.Add("UAH", 2); //Ukraine Hryvnia
oCurrencyDictionary.Add("SEK", 2); //Swedish Kronor
oCurrencyDictionary.Add("ZAR", 2); //South African Rand
oCurrencyDictionary.Add("PKR", 2); //Pakistani Rupee
oCurrencyDictionary.Add("PAB", 2); //Panama Balboa
oCurrencyDictionary.Add("NZD", 2); //New Zealand Dollar
oCurrencyDictionary.Add("MYR", 2); //Malaysian Ringgit
oCurrencyDictionary.Add("SGD", 2); //Singapore Dollar
oCurrencyDictionary.Add("BDT", 2); //Bangladeshi Taka
#endregion
if (oCurrencyDictionary.ContainsKey(CurrencySymbols))
{
return oCurrencyDictionary[CurrencySymbols];
}
else
{
return 2;
}
}
0 comments:
Post a Comment