C#人民币转换
来源:互联网 发布:怎样优化网站 编辑:程序博客网 时间:2024/05/10 00:28
using NSNumTranslateFactory;
namespace NSNumToChs
{
public class NumToChs : NumTranslateFactory
{
private string StIntUnit = "萬千佰拾億千佰拾萬千佰拾元角分厘毫";
private string StCht = "零壹貳參肆伍陸柒捌玫";
public override string GetTransResult(double Num, int DigCount)
{
int NumLen;
string StIntResult = "", StActuUnit = "";
Num = System.Math.Round(Num, DigCount);
Num = Num * System.Math.Pow(10, DigCount);
string StNum = Num.ToString();
NumLen = Num.ToString().Length;
StActuUnit = StIntUnit.Substring(12+DigCount - NumLen + 1, NumLen);
for (int i = 0; i < NumLen; i++)//connect the stnumtemp and stint
{
StIntResult = StIntResult + StCht[StNum[i] - 48] + StActuUnit[i];
}
StIntResult = StIntResult.Replace("零拾", "零");
StIntResult = StIntResult.Replace("零佰", "零");
StIntResult = StIntResult.Replace("零千", "零");
StIntResult = StIntResult.Replace("零角", "零");
StIntResult = StIntResult.Replace("零分", "零");
StIntResult = StIntResult.Replace("零厘", "零");
StIntResult = StIntResult.Replace("零毫", "零");
StIntResult = StIntResult.Replace("零零零", "零");
StIntResult = StIntResult.Replace("零零", "零");
StIntResult = StIntResult.Replace("零萬", "萬");
StIntResult = StIntResult.Replace("零億", "億");
StIntResult = StIntResult.Replace("零元", "元");
if (StIntResult[StIntResult.Length-1]=='零')
{
StIntResult = StIntResult.Substring(0, StIntResult.Length - 1);
}
return StIntResult;
}
}
}
- C#人民币转换
- c#人民币大写转换
- C#人民币大小写转换
- C# 人民币转换
- 人民币大小写转换 C#版
- C#人民币大小写金额转换
- C#转换人民币大写金额
- C#人民币金额大写转换
- C#人民币大小写金额转换(C#版本)
- c#写的小写人民币转换成大写人民币
- C# 日期处理 转换人民币大小金额
- C# 人民币大小写转换正则表达式
- C#将人民币转换成大写金额
- 人民币转换
- 人民币转换
- 人民币转换
- 人民币转换
- C#实现人民币小写到大写的转换
- 请不要做浮躁的人!
- C#中的命名规则与编码规范
- 图片查看器处理程序
- cmpp发送超长短信息
- Websphere编程之路 《MQ编程 For Delphi》 --MQ编程初探
- C#人民币转换
- 实战Java多线程编程之不提倡的方法
- 中华人民共和国民法通则
- EXCEl导入导出到SQL
- C++程序员经常问的11个问题
- 开源七大盈利模式
- symbian学习总结
- 初始化struts的value参数
- JSP连接MySQL数据库问题