.net数字转换成汉字大写

 public class Num2Rmb {
private String[] hanArr={"","","","","","",
"","","",""};
private String[] unitArr={"","","","","","","","亿","","",""};
private String toHanStr(String numStr)
{
String result="";
int numLen=numStr.length();
for (int i=0;i<numLen; i++)
{
int num=numStr.charAt(i)-48;
if(i!=numLen-1 && num!=0)
{
result+=hanArr[num]+unitArr[numLen-2-i];
}
else
{
result+=hanArr[num];
}
}
return result;
}
public static void main(String[] args)
{
Num2Rmb nr = new Num2Rmb();
System.out.println(nr.toHanStr("633779433451"));
}
}

 

posted @ 2016-08-05 15:12  飘....  阅读(1806)  评论(0编辑  收藏  举报