/// summary/// 输入Float格式数字

时间:2021-10-12 08:44:00

/// <summary> /// 输入Float格局数字,将其转换为货币表达方法 /// </summary> /// <param>货币表达类型:0=带¥的货币表达方法;1=不带¥的货币表达方法;其它=带¥的货币表达方法</param> /// <param>传入的int数字</param> /// <returns>返反转展转换的货币表达形式</returns> public string Rmoney(int ftype, double fmoney) { string _rmoney; try { switch (ftype) { case 0: _rmoney = string.Format("{0:C2}", fmoney); break; case 1: _rmoney = string.Format("{0:N2}", fmoney); break; default: _rmoney = string.Format("{0:C2}", fmoney); break; } } catch { _rmoney = ""; } return _rmoney; } /// <summary> /// 输入Float格局数字,,将其转换为货币表达方法 /// </summary> /// <param>货币表达类型:0=人民币;1=港币;2=美钞;3=英镑;4=不带货币;其它=不带货币表达方法</param> /// <param>传入的int数字</param> /// <returns>返反转展转换的货币表达形式</returns> public static string ConvertCurrency(decimal fmoney) { CultureInfo cul = null; int ftype=4; string _rmoney=string.Empty; try { switch (ftype) { case 0: cul = new CultureInfo("zh-CN");//* _rmoney = fmoney.ToString("c", cul); break; case 1: cul = new CultureInfo("zh-HK");//香港 _rmoney = fmoney.ToString("c", cul); break; case 2: cul = new CultureInfo("en-US");//美国 _rmoney = fmoney.ToString("c", cul); break; case 3: cul = new CultureInfo("en-GB");//英国 _rmoney = fmoney.ToString("c", cul); break; case 4: _rmoney = string.Format("{0:n}", fmoney);//没有货币标记 break; default: _rmoney = string.Format("{0:n}", fmoney); break; } } catch { _rmoney = ""; } return _rmoney; }