java 数字转化为汉字大写的工具类
public class Num2Rmb {02
private String[] hanArr={"零","壹","贰","叁","肆","伍",
03
"陆","柒","捌","玖"};
04
private String[] unitArr={"拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟"};
05
06
private String toHanStr(String numStr)
07
{
08
String result="";
09
int numLen=numStr.length();
10
for (int i=0;i<numLen; i++)
11
{
12
int num=numStr.charAt(i)-48;
13
if(i!=numLen-1 && num!=0)
14
{
15
result+=hanArr+unitArr;
16
}
17
else
18
{
19
result+=hanArr;
20
}
21
}
22
return result;
23
}
24
public static void main(String[] args)
25
{
26
Num2Rmb nr = new Num2Rmb();
27
28
System.out.println(nr.toHanStr("633779433451"));
29
}
30
}
页:
[1]