C# Double String互转

/// <summary>
/// str转金额 元
/// </summary>
/// <param name="money"></param>
/// <param name="type">分100 毛10</param>
/// <returns>str</returns>
public static Double strToDouble(string money, int type)
{
if (String.IsNullOrEmpty(money))
{
money = "0";
}
string temp = "0";
//去开头0
temp = money.TrimStart('0').Trim();
if (String.IsNullOrEmpty(temp))
{
temp = "0";
}
return Convert.ToDouble(temp) / type;
}

posted @ 2015-05-20 16:16  阿亮的笔记  阅读(4560)  评论(0编辑  收藏  举报