using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
public partial class MoneyUpperWrite : System.Web.UI.Page
{
private char[] bigChar = {'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'};
private char[] powerChar = { '万', '仟', '佰', '拾', '亿', '仟', '佰', '拾', '万', '仟', '佰', '拾', '元', '角', '分' };
private string[,] replaceStr = {{"零元", "元"},
{"零拾", "零"},
{"零佰", "零"},
{"零仟", "零"},
{"零万", "万"},
{"零亿", "亿"},
{"亿万", "亿"},
{"零零零", "零"},
{"零零", "零"},
{"零万", "万"},
{"零亿", "亿"},
{"亿万", "亿"},
{"零元", "元"},
{"零角", "零"},
{"零分", "整"},
{"零整", "整"}};
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//Response.Write(NumToChar(Convert.ToDouble(TextBox1.Text)));
TextBox2.Text = NumToChar(Convert.ToDouble(TextBox1.Text));
}
private string NumToChar(double Num)
{
string Money = string.Format("{0,15:0}", Num * 100);
string Ret = "";
for (int i = 0; i < 15; i++)
{
string tmpChar = Money.Substring(i, 1);
if (tmpChar == " ")
{
continue;
}
else
{
Ret += bigChar[Convert.ToInt32(tmpChar)];
Ret += powerChar[i];
}
}
for (int i = 0; i < replaceStr.GetLength(0); i++)
{
Ret = Strings.Replace(Ret, replaceStr[i, 0], replaceStr[i, 1], 1, -1, CompareMethod.Text);
}
return Ret;
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
public partial class MoneyUpperWrite : System.Web.UI.Page
{
private char[] bigChar = {'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'};
private char[] powerChar = { '万', '仟', '佰', '拾', '亿', '仟', '佰', '拾', '万', '仟', '佰', '拾', '元', '角', '分' };
private string[,] replaceStr = {{"零元", "元"},
{"零拾", "零"},
{"零佰", "零"},
{"零仟", "零"},
{"零万", "万"},
{"零亿", "亿"},
{"亿万", "亿"},
{"零零零", "零"},
{"零零", "零"},
{"零万", "万"},
{"零亿", "亿"},
{"亿万", "亿"},
{"零元", "元"},
{"零角", "零"},
{"零分", "整"},
{"零整", "整"}};
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//Response.Write(NumToChar(Convert.ToDouble(TextBox1.Text)));
TextBox2.Text = NumToChar(Convert.ToDouble(TextBox1.Text));
}
private string NumToChar(double Num)
{
string Money = string.Format("{0,15:0}", Num * 100);
string Ret = "";
for (int i = 0; i < 15; i++)
{
string tmpChar = Money.Substring(i, 1);
if (tmpChar == " ")
{
continue;
}
else
{
Ret += bigChar[Convert.ToInt32(tmpChar)];
Ret += powerChar[i];
}
}
for (int i = 0; i < replaceStr.GetLength(0); i++)
{
Ret = Strings.Replace(Ret, replaceStr[i, 0], replaceStr[i, 1], 1, -1, CompareMethod.Text);
}
return Ret;
}
}