梦醒三分,执着疯子
没有什么不可以!
        最近做项目时,要求将数值转换成大写。用了非常笨的方法写了出来,而且只能处理8位整数和两位小数的情况。很丢人啊,本来不想贴出来的,但为了给自己一个警醒,编码时能够多想想。
public string GetUpperNum(string numStr)
  {
   string intStr=numStr.Substring(0,numStr.Length-3);
   string demStr=numStr.Substring(numStr.Length-2,2);
   string tempInt="";
   string tempDem="";
   int t=0;
//整数部分
   if(intStr.Length>8) return "数字过大,不处理";
   else
   {
    switch(intStr.Length)
    {
     case 1:
     {
      switch(intStr)
      {
       case "0":
        tempInt="";
        break;
       case "1":
                                tempInt = tempInt + "壹 元 ";
        break;     
       case "2":
                          tempInt = tempInt + "贰 元 ";
        break;
       case "3":
                          tempInt = tempInt + "叁 元 ";
        break;
       case "4":
                          tempInt = tempInt + "肆 元 ";
        break;
       case "5":
                          tempInt = tempInt + "伍 元 ";
        break;
       case "6":
                          tempInt = tempInt + "陆 元 ";
        break;
       case "7":
                          tempInt = tempInt + "柒 元 ";
        break;
       case "8":
                          tempInt = tempInt + "捌 元 ";
        break;
       case "9":
                          tempInt = tempInt + "玖 元 ";
        break;
      }
     }
     break;
     case 2:
     {
      for(t=0;t<2;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 拾 ";
         else tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 拾 ";
         else tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 拾 ";
         else tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 拾 ";
         else tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 拾 ";
         else tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 拾 ";
         else tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 拾 ";
         else tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 拾 ";
         else tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 拾 ";
         else tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 3:
     {
      for(t=0;t<3;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 拾 ";
         if(t==2) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 佰 ";
         if(t==1) tempInt = tempInt + "壹 拾 ";
         if(t==2) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 佰 ";
         if(t==1) tempInt = tempInt + "贰 拾 ";
         if(t==2) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 佰 ";
         if(t==1) tempInt = tempInt + "叁 拾 ";
         if(t==2) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 佰 ";
         if(t==1) tempInt = tempInt + "肆 拾 ";
         if(t==2) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 佰 ";
         if(t==1) tempInt = tempInt + "伍 拾 ";
         if(t==2) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 佰 ";
         if(t==1) tempInt = tempInt + "陆 拾 ";
         if(t==2) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 佰 ";
         if(t==1) tempInt = tempInt + "柒 拾 ";
         if(t==2) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 佰 ";
         if(t==1) tempInt = tempInt + "捌 拾 ";
         if(t==2) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 佰 ";
         if(t==1) tempInt = tempInt + "玖 拾 ";
         if(t==2) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 4:
     {
      for(t=0;t<4;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 佰 ";
         if(t==2) tempInt = tempInt + "零 拾 ";
         if(t==3) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 仟 ";
         if(t==1) tempInt = tempInt + "壹 佰 ";
         if(t==2) tempInt = tempInt + "壹 拾 ";
         if(t==3) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 仟 ";
         if(t==1) tempInt = tempInt + "贰 佰 ";
         if(t==2) tempInt = tempInt + "贰 拾 ";
         if(t==3) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 仟 ";
         if(t==1) tempInt = tempInt + "叁 佰 ";
         if(t==2) tempInt = tempInt + "叁 拾 ";
         if(t==3) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 仟 ";
         if(t==1) tempInt = tempInt + "肆 佰 ";
         if(t==2) tempInt = tempInt + "肆 拾 ";
         if(t==3) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 仟 ";
         if(t==1) tempInt = tempInt + "伍 佰 ";
         if(t==2) tempInt = tempInt + "伍 拾 ";
         if(t==3) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 仟 ";
         if(t==1) tempInt = tempInt + "陆 佰 ";
         if(t==2) tempInt = tempInt + "陆 拾 ";
         if(t==3) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 仟 ";
         if(t==1) tempInt = tempInt + "柒 佰 ";
         if(t==2) tempInt = tempInt + "柒 拾 ";
         if(t==3) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 仟 ";
         if(t==1) tempInt = tempInt + "捌 佰 ";
         if(t==2) tempInt = tempInt + "捌 拾 ";
         if(t==3) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 仟 ";
         if(t==1) tempInt = tempInt + "玖 佰 ";
         if(t==2) tempInt = tempInt + "玖 拾 ";
         if(t==3) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 5:
     {
      for(t=0;t<5;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 仟 ";
         if(t==2) tempInt = tempInt + "零 佰 ";
         if(t==3) tempInt = tempInt + "零 拾 ";
         if(t==4) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 万 ";
         if(t==1) tempInt = tempInt + "壹 仟 ";
         if(t==2) tempInt = tempInt + "壹 佰 ";
         if(t==3) tempInt = tempInt + "壹 拾 ";
         if(t==4) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 万 ";
         if(t==1) tempInt = tempInt + "贰 仟 ";
         if(t==2) tempInt = tempInt + "贰 佰 ";
         if(t==3) tempInt = tempInt + "贰 拾 ";
         if(t==4) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 万 ";
         if(t==1) tempInt = tempInt + "叁 仟 ";
         if(t==2) tempInt = tempInt + "叁 佰 ";
         if(t==3) tempInt = tempInt + "叁 拾 ";
         if(t==4) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 万 ";
         if(t==1) tempInt = tempInt + "肆 仟 ";
         if(t==2) tempInt = tempInt + "肆 佰 ";
         if(t==3) tempInt = tempInt + "肆 拾 ";
         if(t==4) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 万 ";
         if(t==1) tempInt = tempInt + "伍 仟 ";
         if(t==2) tempInt = tempInt + "伍 佰 ";
         if(t==3) tempInt = tempInt + "伍 拾 ";
         if(t==4) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 万 ";
         if(t==1) tempInt = tempInt + "陆 仟 ";
         if(t==2) tempInt = tempInt + "陆 佰 ";
         if(t==3) tempInt = tempInt + "陆 拾 ";
         if(t==4) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 万 ";
         if(t==1) tempInt = tempInt + "柒 仟 ";
         if(t==2) tempInt = tempInt + "柒 佰 ";
         if(t==3) tempInt = tempInt + "柒 拾 ";
         if(t==4) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 万 ";
         if(t==1) tempInt = tempInt + "捌 仟 ";
         if(t==2) tempInt = tempInt + "捌 佰 ";
         if(t==3) tempInt = tempInt + "捌 拾 ";
         if(t==4) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 万 ";
         if(t==1) tempInt = tempInt + "玖 仟 ";
         if(t==2) tempInt = tempInt + "玖 佰 ";
         if(t==3) tempInt = tempInt + "玖 拾 ";
         if(t==4) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 6:
     {
      for(t=0;t<6;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 万 ";
         if(t==2) tempInt = tempInt + "零 仟 ";
         if(t==3) tempInt = tempInt + "零 佰 ";
         if(t==4) tempInt = tempInt + "零 拾 ";
         if(t==5) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 拾 ";
         if(t==1) tempInt = tempInt + "壹 万 ";
         if(t==2) tempInt = tempInt + "壹 仟 ";
         if(t==3) tempInt = tempInt + "壹 佰 ";
         if(t==4) tempInt = tempInt + "壹 拾 ";
         if(t==5) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 拾 ";
         if(t==1) tempInt = tempInt + "贰 万 ";
         if(t==2) tempInt = tempInt + "贰 仟 ";
         if(t==3) tempInt = tempInt + "贰 佰 ";
         if(t==4) tempInt = tempInt + "贰 拾 ";
         if(t==5) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 拾 ";
         if(t==1) tempInt = tempInt + "叁 万 ";
         if(t==2) tempInt = tempInt + "叁 仟 ";
         if(t==3) tempInt = tempInt + "叁 佰 ";
         if(t==4) tempInt = tempInt + "叁 拾 ";
         if(t==5) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 拾 ";
         if(t==1) tempInt = tempInt + "肆 万 ";
         if(t==2) tempInt = tempInt + "肆 仟 ";
         if(t==3) tempInt = tempInt + "肆 佰 ";
         if(t==4) tempInt = tempInt + "肆 拾 ";
         if(t==5) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 拾 ";
         if(t==1) tempInt = tempInt + "伍 万 ";
         if(t==2) tempInt = tempInt + "伍 仟 ";
         if(t==3) tempInt = tempInt + "伍 佰 ";
         if(t==4) tempInt = tempInt + "伍 拾 ";
         if(t==5) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 拾 ";
         if(t==1) tempInt = tempInt + "陆 万 ";
         if(t==2) tempInt = tempInt + "陆 仟 ";
         if(t==3) tempInt = tempInt + "陆 佰 ";
         if(t==4) tempInt = tempInt + "陆 拾 ";
         if(t==5) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 拾 ";
         if(t==1) tempInt = tempInt + "柒 万 ";
         if(t==2) tempInt = tempInt + "柒 仟 ";
         if(t==3) tempInt = tempInt + "柒 佰 ";
         if(t==4) tempInt = tempInt + "柒 拾 ";
         if(t==5) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 拾 ";
         if(t==1) tempInt = tempInt + "捌 万 ";
         if(t==2) tempInt = tempInt + "捌 仟 ";
         if(t==3) tempInt = tempInt + "捌 佰 ";
         if(t==4) tempInt = tempInt + "捌 拾 ";
         if(t==5) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 拾 ";
         if(t==1) tempInt = tempInt + "玖 万 ";
         if(t==2) tempInt = tempInt + "玖 仟 ";
         if(t==3) tempInt = tempInt + "玖 佰 ";
         if(t==4) tempInt = tempInt + "玖 拾 ";
         if(t==5) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 7:
     {
      for(t=0;t<7;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "壹 拾 ";
         if(t==2) tempInt = tempInt + "零 万 ";
         if(t==3) tempInt = tempInt + "零 仟 ";
         if(t==4) tempInt = tempInt + "零 佰 ";
         if(t==5) tempInt = tempInt + "零 拾 ";
         if(t==6) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 佰 ";
         if(t==1) tempInt = tempInt + "壹 拾 ";
         if(t==2) tempInt = tempInt + "壹 万 ";
         if(t==3) tempInt = tempInt + "壹 仟 ";
         if(t==4) tempInt = tempInt + "壹 佰 ";
         if(t==5) tempInt = tempInt + "壹 拾 ";
         if(t==6) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 佰 ";
         if(t==1) tempInt = tempInt + "贰 拾 ";
         if(t==2) tempInt = tempInt + "贰 万 ";
         if(t==3) tempInt = tempInt + "贰 仟 ";
         if(t==4) tempInt = tempInt + "贰 佰 ";
         if(t==5) tempInt = tempInt + "贰 拾 ";
         if(t==6) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 佰 ";
         if(t==1) tempInt = tempInt + "叁 拾 ";
         if(t==2) tempInt = tempInt + "叁 万 ";
         if(t==3) tempInt = tempInt + "叁 仟 ";
         if(t==4) tempInt = tempInt + "叁 佰 ";
         if(t==5) tempInt = tempInt + "叁 拾 ";
         if(t==6) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 佰 ";
         if(t==1) tempInt = tempInt + "肆 拾 ";
         if(t==2) tempInt = tempInt + "肆 万 ";
         if(t==3) tempInt = tempInt + "肆 仟 ";
         if(t==4) tempInt = tempInt + "肆 佰 ";
         if(t==5) tempInt = tempInt + "肆 拾 ";
         if(t==6) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 佰 ";
         if(t==1) tempInt = tempInt + "伍 拾 ";
         if(t==2) tempInt = tempInt + "伍 万 ";
         if(t==3) tempInt = tempInt + "伍 仟 ";
         if(t==4) tempInt = tempInt + "伍 佰 ";
         if(t==5) tempInt = tempInt + "伍 拾 ";
         if(t==6) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 佰 ";
         if(t==1) tempInt = tempInt + "陆 拾 ";
         if(t==2) tempInt = tempInt + "陆 万 ";
         if(t==3) tempInt = tempInt + "陆 仟 ";
         if(t==4) tempInt = tempInt + "陆 佰 ";
         if(t==5) tempInt = tempInt + "陆 拾 ";
         if(t==6) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 佰 ";
         if(t==1) tempInt = tempInt + "柒 拾 ";
         if(t==2) tempInt = tempInt + "柒 万 ";
         if(t==3) tempInt = tempInt + "柒 仟 ";
         if(t==4) tempInt = tempInt + "柒 佰 ";
         if(t==5) tempInt = tempInt + "柒 拾 ";
         if(t==6) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 佰 ";
         if(t==1) tempInt = tempInt + "捌 拾 ";
         if(t==2) tempInt = tempInt + "捌 万 ";
         if(t==3) tempInt = tempInt + "捌 仟 ";
         if(t==4) tempInt = tempInt + "捌 佰 ";
         if(t==5) tempInt = tempInt + "捌 拾 ";
         if(t==6) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 佰 ";
         if(t==1) tempInt = tempInt + "玖 拾 ";
         if(t==2) tempInt = tempInt + "玖 万 ";
         if(t==3) tempInt = tempInt + "玖 仟 ";
         if(t==4) tempInt = tempInt + "玖 佰 ";
         if(t==5) tempInt = tempInt + "玖 拾 ";
         if(t==6) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
     case 8:
     {
      for(t=0;t<8;t++)
      {
       switch(intStr.Substring(t,1))
       {
        case "0":
         if(t==1) tempInt = tempInt + "零 佰 ";
         if(t==2) tempInt = tempInt + "壹 拾 ";
         if(t==3) tempInt = tempInt + "零 万 ";
         if(t==4) tempInt = tempInt + "零 仟 ";
         if(t==5) tempInt = tempInt + "零 佰 ";
         if(t==6) tempInt = tempInt + "零 拾 ";
         if(t==7) tempInt = tempInt + "零 元 ";
         break;
        case "1":
         if(t==0) tempInt = tempInt + "壹 仟 ";
         if(t==1) tempInt = tempInt + "壹 佰 ";
         if(t==2) tempInt = tempInt + "壹 拾 ";
         if(t==3) tempInt = tempInt + "壹 万 ";
         if(t==4) tempInt = tempInt + "壹 仟 ";
         if(t==5) tempInt = tempInt + "壹 佰 ";
         if(t==6) tempInt = tempInt + "壹 拾 ";
         if(t==7) tempInt = tempInt + "壹 元 ";
         break;
        case "2":
         if(t==0) tempInt = tempInt + "贰 仟 ";
         if(t==1) tempInt = tempInt + "贰 佰 ";
         if(t==2) tempInt = tempInt + "贰 拾 ";
         if(t==3) tempInt = tempInt + "贰 万 ";
         if(t==4) tempInt = tempInt + "贰 仟 ";
         if(t==5) tempInt = tempInt + "贰 佰 ";
         if(t==6) tempInt = tempInt + "贰 拾 ";
         if(t==7) tempInt = tempInt + "贰 元 ";
         break;
        case "3":
         if(t==0) tempInt = tempInt + "叁 仟 ";
         if(t==1) tempInt = tempInt + "叁 佰 ";
         if(t==2) tempInt = tempInt + "叁 拾 ";
         if(t==3) tempInt = tempInt + "叁 万 ";
         if(t==4) tempInt = tempInt + "叁 仟 ";
         if(t==5) tempInt = tempInt + "叁 佰 ";
         if(t==6) tempInt = tempInt + "叁 拾 ";
         if(t==7) tempInt = tempInt + "叁 元 ";
         break;
        case "4":
         if(t==0) tempInt = tempInt + "肆 仟 ";
         if(t==1) tempInt = tempInt + "肆 佰 ";
         if(t==2) tempInt = tempInt + "肆 拾 ";
         if(t==3) tempInt = tempInt + "肆 万 ";
         if(t==4) tempInt = tempInt + "肆 仟 ";
         if(t==5) tempInt = tempInt + "肆 佰 ";
         if(t==6) tempInt = tempInt + "肆 拾 ";
         if(t==7) tempInt = tempInt + "肆 元 ";
         break;
        case "5":
         if(t==0) tempInt = tempInt + "伍 仟 ";
         if(t==1) tempInt = tempInt + "伍 佰 ";
         if(t==2) tempInt = tempInt + "伍 拾 ";
         if(t==3) tempInt = tempInt + "伍 万 ";
         if(t==4) tempInt = tempInt + "伍 仟 ";
         if(t==5) tempInt = tempInt + "伍 佰 ";
         if(t==6) tempInt = tempInt + "伍 拾 ";
         if(t==7) tempInt = tempInt + "伍 元 ";
         break;
        case "6":
         if(t==0) tempInt = tempInt + "陆 仟 ";
         if(t==1) tempInt = tempInt + "陆 佰 ";
         if(t==2) tempInt = tempInt + "陆 拾 ";
         if(t==3) tempInt = tempInt + "陆 万 ";
         if(t==4) tempInt = tempInt + "陆 仟 ";
         if(t==5) tempInt = tempInt + "陆 佰 ";
         if(t==6) tempInt = tempInt + "陆 拾 ";
         if(t==7) tempInt = tempInt + "陆 元 ";
         break;
        case "7":
         if(t==0) tempInt = tempInt + "柒 仟 ";
         if(t==1) tempInt = tempInt + "柒 佰 ";
         if(t==2) tempInt = tempInt + "柒 拾 ";
         if(t==3) tempInt = tempInt + "柒 万 ";
         if(t==4) tempInt = tempInt + "柒 仟 ";
         if(t==5) tempInt = tempInt + "柒 佰 ";
         if(t==6) tempInt = tempInt + "柒 拾 ";
         if(t==7) tempInt = tempInt + "柒 元 ";
         break;
        case "8":
         if(t==0) tempInt = tempInt + "捌 仟 ";
         if(t==1) tempInt = tempInt + "捌 佰 ";
         if(t==2) tempInt = tempInt + "捌 拾 ";
         if(t==3) tempInt = tempInt + "捌 万 ";
         if(t==4) tempInt = tempInt + "捌 仟 ";
         if(t==5) tempInt = tempInt + "捌 佰 ";
         if(t==6) tempInt = tempInt + "捌 拾 ";
         if(t==7) tempInt = tempInt + "捌 元 ";
         break;
        case "9":
         if(t==0) tempInt = tempInt + "玖 仟 ";
         if(t==1) tempInt = tempInt + "玖 佰 ";
         if(t==2) tempInt = tempInt + "玖 拾 ";
         if(t==3) tempInt = tempInt + "玖 万 ";
         if(t==4) tempInt = tempInt + "玖 仟 ";
         if(t==5) tempInt = tempInt + "玖 佰 ";
         if(t==6) tempInt = tempInt + "玖 拾 ";
         if(t==7) tempInt = tempInt + "玖 元 ";
         break;
       }
      }
     }
     break;
    }
//小数部分
    for(t=0;t<2;t++)
    {
     switch(demStr.Substring(t,1))
     {
      case "0":
       if(t==0) tempDem=tempDem + "零 角 ";
       if(t==1) tempDem=tempDem + "零 分 ";
       if(demStr=="00") tempDem="";
       break;
      case "1":
       if(t==0) tempDem=tempDem + "壹 角 ";
       if(t==1) tempDem=tempDem + "壹 分 ";
       break;
      case "2":
       if(t==0) tempDem=tempDem + "贰 角 ";
       if(t==1) tempDem=tempDem + "贰 分 ";
       break;
      case "3":
       if(t==0) tempDem=tempDem + "叁 角 ";
       if(t==1) tempDem=tempDem + "叁 分 ";
       break;
      case "4":
       if(t==0) tempDem=tempDem + "肆 角 ";
       if(t==1) tempDem=tempDem + "肆 分 ";
       break;
      case "5":
       if(t==0) tempDem=tempDem + "伍 角 ";
       if(t==1) tempDem=tempDem + "伍 分 ";
       break;
      case "6":
       if(t==0) tempDem=tempDem + "陆 角 ";
       if(t==1) tempDem=tempDem + "陆 分 ";
       break;
      case "7":
       if(t==0) tempDem=tempDem + "柒 角 ";
       if(t==1) tempDem=tempDem + "柒 分 ";
       break;
      case "8":
       if(t==0) tempDem=tempDem + "捌 角 ";
       if(t==1) tempDem=tempDem + "捌 分 ";
       break;
      case "9":
       if(t==0) tempDem=tempDem + "玖 角 ";
       if(t==1) tempDem=tempDem + "玖 分 ";
       break;
     }
    }
   }
   return tempInt+tempDem;
  }
posted on 2006-09-12 16:41  Jacker.W  阅读(783)  评论(0编辑  收藏  举报