将阿拉伯数字转化成大写的人民币数字
2013-07-03 16:37
183 查看
public String getNumberToRMB(String m)...{
String num = "零壹贰叁肆伍陆柒捌玖";
String dw = "圆拾佰仟万亿";
String mm[] = null;
mm = m.split("/.");
String money = mm[0];
String result = num.charAt(Integer.parseInt("" + mm[1].charAt(0))) + "角" +
num.charAt(Integer.parseInt("" + mm[1].charAt(1))) + "分";
for (int i = 0; i < money.length(); i++) ...{
String str = "";
int n = Integer.parseInt(money.substring(money.length() - i - 1,
money.length() - i));
str = str + num.charAt(n);
if (i == 0) ...{
str = str + dw.charAt(i);
}
else if ( (i + 4) % 8 == 0) ...{
str = str + dw.charAt(4);
}
else if (i % 8 == 0) ...{
str = str + dw.charAt(5);
}
else ...{
str = str + dw.charAt(i % 4);
}
result = str + result;
}
result = result.replaceAll("零([^亿万圆角分])", "零");
result = result.replaceAll("亿零+万","亿零");
result = result.replaceAll("零+", "零");
result = result.replaceAll("零([亿万圆])", "$1");
result =result.replaceAll("壹拾","拾");
return result;
}
String num = "零壹贰叁肆伍陆柒捌玖";
String dw = "圆拾佰仟万亿";
String mm[] = null;
mm = m.split("/.");
String money = mm[0];
String result = num.charAt(Integer.parseInt("" + mm[1].charAt(0))) + "角" +
num.charAt(Integer.parseInt("" + mm[1].charAt(1))) + "分";
for (int i = 0; i < money.length(); i++) ...{
String str = "";
int n = Integer.parseInt(money.substring(money.length() - i - 1,
money.length() - i));
str = str + num.charAt(n);
if (i == 0) ...{
str = str + dw.charAt(i);
}
else if ( (i + 4) % 8 == 0) ...{
str = str + dw.charAt(4);
}
else if (i % 8 == 0) ...{
str = str + dw.charAt(5);
}
else ...{
str = str + dw.charAt(i % 4);
}
result = str + result;
}
result = result.replaceAll("零([^亿万圆角分])", "零");
result = result.replaceAll("亿零+万","亿零");
result = result.replaceAll("零+", "零");
result = result.replaceAll("零([亿万圆])", "$1");
result =result.replaceAll("壹拾","拾");
return result;
}
相关文章推荐
- 将阿拉伯数字转化为人民币的大写
- 将阿拉伯数字转化成大写的人民币数字
- 将阿拉伯数字转化成大写的人民币数字
- 将阿拉伯数字转化成大写的人民币数字
- 金额大小写转化、阿拉伯数字转大写数字,大写数字转阿拉伯数字
- 写一个程序,语言不限,能将人民币金额从阿拉伯数字转换为大写汉字表示。例如,把1234.56转换为壹仟贰佰叁拾肆圆零伍角陆分。
- 将一串数字转化为中文字符串,使用 C# 将数字转换成大写人民币 (例如:用户输入2300,系统就会显示两千三百元 )
- 阿拉伯数字转化为中文大写
- 人民币大写转阿拉伯数字
- 在word中如何把数字转化成人民币大写?
- Python将阿拉伯数字转化为中文大写
- 数字变成大写的类,把人民币转化为大写汉字
- 银行货币单位阿拉伯数字转化中文大写 eclipse 下C 与java实现 MOOC
- Javascript 阿拉伯数字转化中国大写数字
- 将人民币的数字表示转化成大写表示(VB.NET版) (原chenyu001C#版)
- php阿拉伯数字转化成大写的数字
- 转化十亿以内的人民币数字为大写格式
- 将阿拉伯数字转换成中文大写人民币
- 数字变成大写的类,把人民币转化为大写汉字