asp.net将金额转换成大写的金额

     这个也是从网上找来的代码,稍微改了一点,取之于网络,用之于网络。这个函数很好用,本人目前一直在用。
 /// <summary>
    
/// 将金额转换成大写
    
/// </summary>
    
/// <param name="moneys"></param>
    
/// <returns></returns>

    public static string GetUpperMoney(float moneys)
    

      
         
const string UNIT = "分角元拾佰仟万拾佰仟亿拾佰仟万";
         
const string UPPER = "零壹贰叁肆伍陆柒捌玖";
      
         
string stResult = "", stLower = "";

         stLower 
= moneys.ToString("0.00").Replace(".""");//将点替换变成分角

         
if (stLower.Length <= UNIT.Length)
         
{
             
for (int i = 0, j = stLower.Length - 1; i <= j; i++)
             
{
                 stResult 
+= UPPER[stLower[i] - 48].ToString() + UNIT[j - i].ToString();                 
             }

         }

         
else
         
{
             stResult 
=stLower;
         }


         
return stResult;

    }
二、附加一个MD5加密函数
/// <summary>
    
/// md5加密,code=16或32
    
/// </summary>
    
/// <param name="str"></param>
    
/// <param name="code"></param>
    
/// <returns></returns>

    public string MD5(string str, int code)
    
{
        
if (code == 16//16位MD5加密(取32位加密的9~25字符)
        {
            
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(816);
        }

        
else//32位加密
        {
            
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower();
        }

    }

原文地址:https://www.cnblogs.com/ringwang/p/991247.html