当前位置: 代码迷 >> J2SE >> 求java写将double型数目字(金额转换成)中文大写,
  详细解决方案

求java写将double型数目字(金额转换成)中文大写,

热度:18   发布时间:2016-04-24 15:05:11.0
求java写将double型数字(金额转换成)中文大写,急!
急需求java写将double型数字(金额转换成)中文大写!

------解决方案--------------------
public class Change1
{
public String change(String integer, String decimal)
{
String output = new String();
String output1 = new String();
String output2 = new String();
String temp1 = new String();
//String temp2= " ";
output1 = tochinese(integer.toCharArray());
int j = 0,k=0;
k=output1.length();
for (int i = k; i > 0; i--)
{
temp1 = output1.substring(i-1, i);
/**if(temp1.equals( "零 "))
{
if(temp1.equals(temp2)){
temp2=temp1;
temp1= " ";}
else {
temp2=temp1;
if(i==k)temp1= " ";
}
System.out.println(temp1);
}
else
{
temp2= " ";
*/
switch (j%4)
{
case 0:
break;
case 1:
temp1 += "拾 ";
break;
case 2:
temp1 += "佰 ";
break;
case 3:
temp1 += "仟 ";
break;
}
if (j==4||j==12)
temp1 += "万 ";
if (j==8)
temp1 += "亿 ";
output = temp1 + output;
j++;
}
output+= " "+ " "+ " ";
System.out.println(output);
int s=0;
  相关解决方案