国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

數(shù)值型貨幣的大寫轉(zhuǎn)換

2024-07-21 02:20:49
字體:
供稿:網(wǎng)友
using system;
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;
using system.data;

namespace winmarket
{
/// <summary>
/// classfun 的摘要說明。
/// </summary>
public class classfun
{
private string capstr;

public classfun()
{
//
// todo: 在此處添加構(gòu)造函數(shù)邏輯
//
}
public string moneynumtocap(decimal num)
{
string cap="零壹貳叁肆伍陸柒捌玖";
string numstr="0123456789";
string moneynumstr=num.tostring();
int pint=moneynumstr.indexof(".");
int numint;

string moneyint=null;
string moneydec=null;
string intstr=null;
string moneycap=null;
string moneyintstr=null;
string moneydecstr=null;
// capstr=pint.tostring();

if(pint!=-1)
{
string strarr=".";
char[] chararr=strarr.tochararray();
string[] moneynumarr=moneynumstr.split(chararr);
moneyint=moneynumarr[0].tostring();
moneydec=moneynumarr[1].tostring();

}
else
{
moneyint=moneynumstr;
moneydec="00";
}

if(moneyint.length>16)
{
messagebox.show("數(shù)值超界");
}
else
{
//--- 處理整數(shù)部分--------

for(int j=1;j<=moneyint.length;j++)
{
moneyintstr=moneyint.substring(j-1,1);
for(int i=0;i<=9;i++)
{

intstr=numstr.substring(i,1);
moneycap=cap.substring(i,1);

if(moneyintstr==intstr)
{

switch (intstr)
{
case "0":
capstr=capstr+moneycap;
break;
case "1":
capstr=capstr+moneycap;
break;
case "2":
capstr=capstr+moneycap;
break;
case "3":
capstr=capstr+moneycap;
break;
case "4":
capstr=capstr+moneycap;
break;
case "5":
capstr=capstr+moneycap;
break;
case "6":
capstr=capstr+moneycap;
break;
case "7":
capstr=capstr+moneycap;
break;
case "8":
capstr=capstr+moneycap;
break;
case "9":
capstr=capstr+moneycap;
break;
}
}
}
numint=moneyint.length-j+1;
switch (numint)
{
case 16:
capstr=capstr+"仟萬";
break;
case 15:
capstr=capstr+"佰萬";
break;
case 14:
capstr=capstr+"拾萬";
break;
case 13:
capstr=capstr+"萬";
break;

case 12:
capstr=capstr+"仟";
break;

case 11:
capstr=capstr+"佰";
break;

case 10:
capstr=capstr+"拾";
break;

case 9:
capstr=capstr+"億";
break;

case 8:
capstr=capstr+"仟";
break;

case 7:
capstr=capstr+"佰";
break;

case 6:
capstr=capstr+"拾";
break;


case 5:
capstr=capstr+"萬";
break;

case 4:
capstr=capstr+"仟";
break;
case 3:
capstr=capstr+"佰";
break;
case 2:
capstr=capstr+"拾";
break;
case 1:
capstr=capstr+"元";
break;

}

}

//------處理小數(shù)部分-----
for(int j=1; j<=2; j++)
{
moneydecstr=moneydec.substring(j-1,1);

for(int i=0;i<=9;i++)
{
intstr=numstr.substring(i,1);
moneycap=cap.substring(i,1);
if(moneydecstr==intstr)
{

switch (intstr)
{
case "0":
capstr=capstr+moneycap;
break;
case "1":
capstr=capstr+moneycap;
break;
case "2":
capstr=capstr+moneycap;
break;
case "3":
capstr=capstr+moneycap;
break;
case "4":
capstr=capstr+moneycap;
break;
case "5":
capstr=capstr+moneycap;
break;
case "6":
capstr=capstr+moneycap;
break;
case "7":
capstr=capstr+moneycap;
break;
case "8":
capstr=capstr+moneycap;
break;
case "9":
capstr=capstr+moneycap;
break;
}
}
}


switch(j)
{
case 1:
capstr=capstr+"角";
break;
case 2:
capstr=capstr+"分";
break;

}

}

}

return capstr;
}
}
}





發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 大田县| 嘉义县| 肥乡县| 柘荣县| 岳池县| 咸阳市| 襄城县| 东丰县| 雷波县| 德兴市| 财经| 兴宁市| 丰原市| 炉霍县| 皋兰县| 台中县| 陆川县| 丰都县| 祁连县| 合作市| 县级市| 本溪| 嘉峪关市| 蓬安县| 尖扎县| 乌审旗| 宾川县| 白城市| 益阳市| 西贡区| 安徽省| 萝北县| 仙游县| 九龙坡区| 新龙县| 中牟县| 公主岭市| 大厂| 久治县| 宁武县| 安陆市|