金额加上逗号标识符 - GetShowCurrency
2017-02-26 15:23:17 访问(1652) 赞(0) 踩(0)
/// <summary>
/// 金额加上逗号标识符 - GetShowCurrency
/// </summary>
/// <param name="theValue"></param>
/// <returns></returns>
public static string GetShowCurrency(decimal theValue)
{
return GetShowCurrency(theValue, true);
}
/// <summary>
/// 金额加上逗号标识符 - GetShowCurrency
/// </summary>
/// <param name="theValue"></param>
/// <param name="isRound"></param>
/// <returns></returns>
public static string GetShowCurrency(decimal theValue, bool isRound)
{
if (theValue == 0)
return "0";
if (theValue < 0)
{
return "-" + GetShowCurrency(-theValue, isRound);
}
decimal convertValue = theValue;
if (isRound)
convertValue = Math.Round(theValue, 2);
string strValue = convertValue.ToString();
return GetShowCurrencyByStr(strValue);
}
/// <summary>
/// 金额加上逗号标识符 - GetShowCurrency
/// </summary>
/// <param name="theValue"></param>
/// <returns></returns>
public static string GetShowCurrency(float theValue)
{
return GetShowCurrency(theValue, true);
}
/// <summary>
/// 金额加上逗号标识符 - GetShowCurrency
/// </summary>
/// <param name="theValue"></param>
/// <param name="isRound"></param>
/// <returns></returns>
public static string GetShowCurrency(float theValue, bool isRound)
{
if (theValue == 0)
return "0";
if (theValue < 0)
{
return "-" + GetShowCurrency(-theValue, isRound);
}
float convertValue = (float)Math.Round((double)theValue, 2);
string strValue = convertValue.ToString();
return GetShowCurrencyByStr(strValue);
}
标签:
金额加上逗号标识符 - GetShowCurrency 


上一条:
下一条:
相关评论
发表评论