大写数字

金额小写转中文大写类

痞子三分冷 提交于 2020-01-28 07:24:22
using System; using System.Collections.Generic; using System.Text; namespace Class_ZhH { /// <summary> /// 金额小写转中文大写类(附带一个数字转大写)。 /// 整数支持到万亿;小数部分支持到分(超过两位将进行Banker舍入法处理) /// </summary> public class NumGetString { private static String[] Ls_ShZ ={ "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾" }; private static String[] Ls_DW_Zh ={ "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万" }; private static String[] Num_DW ={ "","拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万" }; private static String[] Ls_DW_X ={ "角", "分" }; /// <summary> /// 金额小写转中文大写。 /// 整数支持到万亿

国庆练习3

牧云@^-^@ 提交于 2020-01-26 04:00:05
Benches CF 1042A There are n n benches in the Berland Central park. It is known that a i ai people are currently sitting on the i i-th bench. Another m m people are coming to the park and each of them is going to have a seat on some bench out of n n available. Let k k be the maximum number of people sitting on one bench after additional m mpeople came to the park. Calculate the minimum possible k k and the maximum possible k k. Nobody leaves the taken seat during the whole process. Input The first line contains a single integer n ( 1 ≤ n ≤ 100 ) — the number of benches in the park. The second

将数字金额转换成大写金额dll

我是研究僧i 提交于 2020-01-23 19:26:29
public class MoneyConvertChinese { /// <summary> ///金额转换成大写 /// </summary> /// <param name="LowerMoney">要转换的金额</param> /// <returns>大写金额</returns> public string MoneyToChinese(string LowerMoney) { string functionReturnValue = null; bool IsNegative = false;//是否是负数 if (LowerMoney.Trim().Substring(0, 1) == "-") { LowerMoney = LowerMoney.Trim().Remove(0, 1); IsNegative = true; } try { string strLower = null; string strUPart = null; string strUpper = null; int iTemp = 0; LowerMoney = Math.Round(double.Parse(LowerMoney), 2).ToString(); //保留到两位小数 if (LowerMoney.IndexOf(".") > 0) { if (LowerMoney

java编写的金额转中文大写

不羁的心 提交于 2020-01-23 19:19:20
1 package com.coxon.finance.tool; 2 3 public class ChinaNumber 4 { 5 6 private static String[] CH = { "", "", "拾", "佰", "仟", "万", "", "", "", "亿", "", "", "", "兆" }; 7 8 private static String[] CHS_NUMBER={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}; 9 10 /** 11 * 传入数字金额字符串,返回数字金额对应的中文大字与读法 12 * 13 * @param money 14 * 金额字符串 15 * @return 金额中文大写 16 */ 17 public static String getCHSNumber(String money) 18 { 19 String chs = ""; 20 21 String tmp_int = money.substring(0, money.indexOf(".")); 22 String tmp_down = money.substring(money.indexOf(".") + 1, money.length()); 23 24 char[] tmp_int_char = tmp

数字金额转换为大写中文金额

丶灬走出姿态 提交于 2020-01-23 19:18:49
经过测试,如果不行可以拍砖!!!!!!!! public class ConvertToZhCN { private static String[] Ls_ShZ ={ "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾" }; private static String[] Ls_DW_Zh ={ "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万" }; private static String[] Num_DW ={ "","拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万" }; private static String[] Ls_DW_X ={ "角", "分" }; /// <summary> /// 金额小写转中文大写。 /// 整数支持到万亿;小数部分支持到分(超过两位将进行Banker舍入法处理) /// </summary> /// <param name="Num">需要转换的双精度浮点数</param> /// <returns>转换后的字符串</returns> public static String NumGetStr(double Num) {

C#数字转换成大写汉字程序

浪子不回头ぞ 提交于 2020-01-23 19:07:09
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { public class Program { static void Main(string[] args) { System.Console.Write("金额: "); string s = System.Console.ReadLine(); double m; try { m = double.Parse(s); Money money = new Money(m); Console.WriteLine(money.Convert()); } catch (FormatException ex) { System.Console.WriteLine(ex.Message); } } } public class Money { /// <summary> /// 要转换的数字 /// </summary> private double j; /// <summary> /// /// </summary> private string[] NumChineseCharacter = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆",

数字大写转换

强颜欢笑 提交于 2020-01-13 12:54:45
主函数 function DX(n) { if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) return "数据非法"; var unit = "千百拾亿千百拾万千百拾元角分", str = ""; n += "00"; var p = n.indexOf('.'); if (p >= 0) n = n.substring(0, p) + n.substr(p + 1, 2); unit = unit.substr(unit.length - n.length); for (var i = 0; i < n.length; i++) str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i); return str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整"); } 调用函数 <script> //alert(DX(<%=mTotalAmount %>)); document.getElementById("Text2").value = DX(<

python基础二

给你一囗甜甜゛ 提交于 2020-01-10 11:05:27
一. 格式化输出 现有一练习需求,问用户的姓名、年龄、工作、爱好 ,然后打印成以下格式 ------------ info of 太白金星 ----------- Name : 太白金星 Age : 22 job : Teacher Hobbie : girl ------------- end ---------------- 你怎么实现呢?你会发现,用字符拼接的方式还难实现这种格式的输出,所以一起来学一下新姿势 只需要把要打印的格式先准备好, 由于里面的 一些信息是需要用户输入的,你没办法预设知道,因此可以先放置个占位符,再把字符串里的占位符与外部的变量做个映射关系就好啦 name = input ( "Name:" ) age = input ( "Age:" ) job = input ( "Job:" ) hobbie = input ( "Hobbie:" ) info = ''' ------------ info of %s ----------- #这里的每个%s就是一个占位符,本行的代表 后面拓号里的 name Name : %s #代表 name Age : %s #代表 age job : %s #代表 job Hobbie: %s #代表 hobbie ------------- end ----------------- ''' %( name ,

数字转换为人民币大写

扶醉桌前 提交于 2020-01-10 00:23:59
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <script type="text/javascript"><!-- function convertCurrency(currencyDigits) { // Constants: var MAXIMUM_NUMBER = 99999999999.99; // Predefine the radix characters and currency symbols for output: var CN_ZERO = "零"; var CN_ONE = "壹"; var CN_TWO = "贰"; var CN_THREE = "叁"; var CN_FOUR = "肆"; var CN_FIVE = "伍"; var CN_SIX = "陆"; var CN_SEVEN = "柒"; var CN_EIGHT = "捌"; var CN_NINE = "玖"; var CN_TEN = "拾"; var CN_HUNDRED = "佰"; var CN_THOUSAND = "仟"; var CN_TEN_THOUSAND = "万"; var CN_HUNDRED_MILLION = "亿";

数字金额转换大写人民币

[亡魂溺海] 提交于 2020-01-08 23:34:10
using System; using System.Collections.Generic; using System.Text; namespace PublicClass { /// <summary> /// Copyright(c) 2008~2011 KingBoy Software Co.,Ltd /// FileName:大写人民币类 /// Author:KingBoy Version:1.0.0.0 Date:2009-3-05 /// Description:提供将数值型输入转变成人民币大写的标准类。 /// </summary> public class ChineseMoney { private decimal dMoney = 0; //金额 /// <summary> /// 设置或获取金额 /// </summary> public decimal money { get { return dMoney; } set { dMoney = value; } } public ChineseMoney(decimal m) { dMoney = m; } /// <summary> /// 获取金额大写 /// </summary> /// <returns></returns> public string getChineseMoney() {