钱转大写

private string ConvertUper(float money)
  {
   string ls_money_unit="",ls_money,ls_unit,ls_badge="";
   int li_long,li_i;
   
   ls_money=decimal.Round((decimal)money,2).ToString("0.00");

   li_long=ls_money.Length;

   for(li_i=1;li_i<li_long+1;li_i++)
   {
    ls_unit=ls_money.Substring(li_long-li_i,li_i);
    ls_unit=ls_unit.Substring(0,1);

    if (ls_unit!=".")
    {
     switch (ls_unit)
     {
      case "0" :
       ls_unit="零";
       break;

      case "1" :
       ls_unit="壹";
       break;

      case "2" :
       ls_unit="贰";
       break;

      case "3" :
       ls_unit="叁";
       break;

      case "4" :
       ls_unit="肆";
       break;

      case "5" :
       ls_unit="伍";
       break;

      case "6" :
       ls_unit="陆";
       break;

      case "7" :
       ls_unit="柒";
       break;

      case "8" :
       ls_unit="捌";
       break;

      case "9" :
       ls_unit="玖";
       break;

     }

     switch(li_i)
     {

      case 1 :
       ls_badge="分整";
       break;

      case 2 :
       ls_badge="角";
       break;

      case 3 :
       ls_badge="";
       break;

      case 4 :
       ls_badge="元";
       break;

      case 5 :
       ls_badge="拾";
       break;

      case 6 :
       ls_badge="佰";
       break;

      case 7 :
       ls_badge="仟";
       break;

      case 8 :
       ls_badge="万";
       break;

      case 9 :
       ls_badge="拾";
       break;

      case 10 :
       ls_badge="佰";
       break;

      case 11 :
       ls_badge="仟";
       break;

      case 12 :
       ls_badge="亿";
       break;

      case 13:
       ls_badge="拾";
       break;

      case 14 :
       ls_badge="佰";
       break;

      case 15 :
       ls_badge="仟";
       break;

     }

       ls_money_unit=ls_unit+ls_badge+ls_money_unit;
    }
   }

   return  ls_money_unit;

  }

阅读更多
文章标签: badge string float
个人分类: c#
上一篇Access内保存图像Test
下一篇WPE教学之-Filter篇
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭