三层结构汉字大写数字转换为小写数字.doc_第1页
三层结构汉字大写数字转换为小写数字.doc_第2页
三层结构汉字大写数字转换为小写数字.doc_第3页
三层结构汉字大写数字转换为小写数字.doc_第4页
三层结构汉字大写数字转换为小写数字.doc_第5页
全文预览已结束

VIP免费下载

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

三层结构 汉字数字转换成小写数字-枚举类-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 ljtshipin.Model / / 此类是枚举类 / 用于判断是否在方法的处理范围之内 / public enum RMBEm yes, 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.BLL public class RMBBLL public RMBEm YesOrNoByString(string rmb) return new RMBClass().YesOrNoByString(rmb); / / / / RMB字符串 / public int RMB(string hh) try int 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; else return RMB; else 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 ljtshipin.Model;using System.Text;namespace ljtshipin.DAL public class RMBClass / / 此方法用于处理负数 / 和上亿(包括亿)的大写数字 / / 大写的数字 / 枚举类 public RMBEm YesOrNoByString(string rmb) if (rmb.Contains(负) | rmb.Contains(亿) return RMBEm.no; else return RMBEm.yes; / / / / RMB字符串 / public int RMB(string hh) hh = hh.Replace(一, 1); hh = hh.Replace(二, 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()*10000 + NewMethod(wan1.ToString(); else if (wan.Length = 1) return NewMethod(wan0.ToString(); else return 0; / / / / 要转换的字符串 / private int NewMethod(string ss) int numwan = 0; int totalpart = 0; try totalpart = Convert.ToInt32(ss) * 10000; catch (Exception ex) for (int i = 0; i ss.Length; i+) try string ss1 = 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 = ss.Replace(ss2, ); break; catch (Exception ex1) continue; if (ss != ) return totalpart + Convert.ToInt32(ss); else return totalpart; -UI层-string hh = 五千五十一万四千六百七十六;RMBBLL rmbll=new RMBBLL ();if (rmbll.Ye

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论