# 一个简单的将数字转化为汉字大写的方法

package com.abc.ebank.util;

/**
* @author wangshuangli
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Digit2ChineseNumber {

/**
* Constructor for Digit2ChineseNumber.
*/
public Digit2ChineseNumber() {
super();
}
/**将金额小写转化为大写
* Method Number2Cap.
* @param amount
* @return String
* 首先将小写数字转化为大写汉字,中间不作其他事情
* 然后再在其中添加"万"等东西;
*/
public static String Number2Cap(String amount) {

amount = Num2ChCap(amount);

String s_decimal = "";
if (amount.indexOf('.') != -1) { //有小数点的情况
if (s_decimal.trim().equals("零零")) {
s_decimal = "";
} else if (s_decimal.trim().equals("零")) {
s_decimal = "";
} else {
}
} else {
}
s_Int = Coordinate_String(s_Int); //整理字符串将一些多余的东西去除
return s_Int + s_decimal + "整";
}

/**整理字符串将一些多余的东西去除如零元零万等
* Method Coordinate_String.
* @param s_Int
* @return String
*/
private static String Coordinate_String(String s_Int) {
//for循环去除零
for (; true;) {
}
}
}
}
}
break;
}
String tmp = "@亿@万@千@佰@拾亿万亿仟亿佰亿拾万仟万佰万拾仟佰仟拾佰拾";
s_Int = "@" + s_Int;
for (int i = 0; i < tmp.length();) {
String tmp1 = tmp.substring(i, i + 2);
for (; true;) {
break;
s_Int =
}
i += 2;
}
return s_Int.substring(1);
}

/**添加万仟佰拾亿仟佰拾万仟佰拾元到字符串对应位置
* @param s_Int
* @return String
*/
private static String IntAddUnit(String s_Int) {
String Units = "元拾佰仟万拾佰仟亿拾佰仟万";

s_Int = StringOverTurn(s_Int);
int s_Int_length = s_Int.length();
String tmp = "";
for (int i = 0; i < s_Int_length; i++) {
tmp =
tmp
+ String.valueOf(Units.charAt(i))
+ String.valueOf(s_Int.charAt(i));
}
tmp = StringOverTurn(tmp);
return tmp;
}

/**字符串翻转将从abcdefg翻转为gfedcba
* Method StringOverTurn.
* @param s_Int
* @return String
*/
private static String StringOverTurn(String s_Int) {
;
int s_Int_length = s_Int.length();
char[] Overtmp = s_Int.toCharArray();
String tmp = "";
for (int i = s_Int_length - 1; i > -1; i--) {
tmp = tmp + Overtmp[i];
}
return tmp;
}

/**将角分加入字符串对应位置中
* @param s_decimal
* @return String
*/
private static String DecAddUnit(String returnString) {

switch (returnString.length()) {
//小数长度为1表示只有角无分
case 1 :
returnString =
returnString.substring(0, 1)
+ "角"
+ returnString.substring(2);

break;
//小数长度为2表示有角有分
case 2 :
returnString =
returnString.substring(0, 1)
+ "角"
+ returnString.substring(1, 2)
+ "分";

break;
} //end of swtich
return returnString;
}

/**将数字转换为中文大写
* 返回格式为壹贰.壹贰
* Method Num2ChCap.
* @param amount
* @return String
*/
private static String Num2ChCap(String amount) {
int length = amount.length();
char CapNumber;
String returnString = "";
for (int i = 0; i < length; i++) {
CapNumber = amount.charAt(i);
switch (CapNumber) {
case '0' :
returnString = returnString + "零";
break;
case '1' :
returnString = returnString + "壹";
break;
case '2' :
returnString = returnString + "贰";
break;
case '3' :
returnString = returnString + "叁";
break;
case '4' :
returnString = returnString + "肆";
break;
case '5' :
returnString = returnString + "伍";
break;
case '6' :
returnString = returnString + "陆";
break;
case '7' :
returnString = returnString + "柒";
break;
case '8' :
returnString = returnString + "捌";
break;
case '9' :
returnString = returnString + "玖";
break;
case '.' :
returnString = returnString + ".";
break;
} //end of case;
} //end of for;
return returnString;

}

// public static void main(String[] args) {
// }
}

#### 把一个用阿拉伯数字表示的正整数转换成汉字大写表示

2017-08-07 09:31:08

#### 将阿拉伯数字转为中文大写读法

2012-08-09 15:08:50

#### js 将数字转换成中文大写

2018-01-26 17:10:45

#### 用C++编写数字转换成汉字大写的程序

2008年10月19日 9KB 下载

#### c++阿拉伯数字转化为中文大写

2014-03-19 23:08:02

#### 将数字转为中文金额的大写方式（C++版）

2014-03-08 15:57:38

#### 用Python将数字转换为中文大写

2013-04-06 04:26:50

#### Python 中文(大写)数字转阿拉伯数字

2016-10-11 17:37:42

#### C语言将数字转成大写中文数字

2017-07-20 11:07:30

#### 使用 JAVA 将数字金额转换成大写中文金额

2011-12-07 23:28:34