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: 在此处添加构造函数逻辑
//
}
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("数值超界");
}
else
{
//--- 处理整数部分--------
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: