三层结构汉字大写数字转换为小写数字

上传人:飞*** 文档编号:5030942 上传时间:2017-08-27 格式:DOC 页数:5 大小:62.50KB
返回 下载 相关 举报
三层结构汉字大写数字转换为小写数字_第1页
第1页 / 共5页
三层结构汉字大写数字转换为小写数字_第2页
第2页 / 共5页
三层结构汉字大写数字转换为小写数字_第3页
第3页 / 共5页
三层结构汉字大写数字转换为小写数字_第4页
第4页 / 共5页
三层结构汉字大写数字转换为小写数字_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《三层结构汉字大写数字转换为小写数字》由会员分享,可在线阅读,更多相关《三层结构汉字大写数字转换为小写数字(5页珍藏版)》请在金锄头文库上搜索。

1、三层结构 汉字数字转换成小写数字-枚举类-using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace lj

2、tshipin.Model/ / 此类是枚举类/ 用于判断是否在方法的处理范围之内/ public enum RMBEmyes, no-BLL层-using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using ljtshipin.Model;using ljtshipin.DAL;namespace ljtshipin.BLLpublic class R

3、MBBLLpublic RMBEm YesOrNoByString(string rmb)return new RMBClass().YesOrNoByString(rmb); / / / / RMB字符串/ public int RMB(string hh)tryint i = Convert.ToInt32(hh);return i;catch (Exception ex)if (this.YesOrNoByString(hh) = RMBEm.yes)int RMB =new RMBClass().RMB(hh);if (RMB = 0)return 0;elsereturn RMB;e

4、lse return 0;-DAL层-using System;using System.Data;using System.Configuration;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using ljtshipi

5、n.Model;using System.Text;namespace ljtshipin.DALpublic class RMBClass/ / 此方法用于处理负数/ 和上亿(包括亿)的大写数字/ / 大写的数字/ 枚举类public RMBEm YesOrNoByString(string rmb)if (rmb.Contains(负) | rmb.Contains(亿)return RMBEm.no;elsereturn RMBEm.yes;/ / / / RMB字符串/ public int RMB(string hh)hh = hh.Replace(一, 1);hh = hh.Rep

6、lace(二, 2);hh = hh.Replace(三, 3);hh = hh.Replace(四, 4);hh = hh.Replace(五, 5);hh = hh.Replace(六, 6);hh = hh.Replace(七, 7);hh = hh.Replace(八, 8);hh = hh.Replace(九, 9); hh = hh.Replace(零,);StringBuilder sb = new StringBuilder(hh);string wan=hh.Split (万);if (wan.Length = 2)return NewMethod(wan0.ToString

7、()*10000 + NewMethod(wan1.ToString();else if (wan.Length = 1)return NewMethod(wan0.ToString();elsereturn 0;/ / / / 要转换的字符串/ private int NewMethod(string ss)int numwan = 0;int totalpart = 0;trytotalpart = Convert.ToInt32(ss) * 10000;catch (Exception ex)for (int i = 0; i ss.Length; i+)trystring ss1 =

8、ss.Substring(0, 1);numwan = Convert.ToInt32(ss1);string ss2 = ss.Substring(0, 2);if (ss2.Contains(千)totalpart = numwan * 1000;ss = ss.Replace(ss2, );else if (ss2.Contains(百) totalpart = totalpart + numwan * 100;ss = ss.Replace(ss2, );else if (ss2.Contains(十)totalpart = totalpart + numwan * 10;ss = s

9、s.Replace(ss2, );break;catch (Exception ex1)continue;if (ss != )return totalpart + Convert.ToInt32(ss);elsereturn totalpart;-UI层-string hh = 五千五十一万四千六百七十六;RMBBLL rmbll=new RMBBLL ();if (rmbll.YesOrNoByString(hh) = RMBEm.yes)RMBClass rmbclass = new RMBClass();int sss = rmbclass.RMB(hh);Label1.Text =转换前:+hh+转换后:+sss.ToString ();-测试结果-

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 研究报告 > 综合/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号