有个比较笨点的:
判断每个字符,然后条件if(c.equals("1")){.....}
依此类推。

解决方案 »

  1.   

    http://www.csdn.net/Develop/Read_Article.asp?Id=15823
      

  2.   

    从CSDN上整理出五个方案,请参考:1、(JAVA)
    public static String numtochinese(String input){
       String s1="零壹贰叁肆伍陆柒捌玖";
       String s4="分角整元拾佰仟万拾佰仟亿拾佰仟";
       String temp="";
       String result="";
       if (input==null) return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!";
       temp=input.trim();
       float f;
       try{
           f=Float.parseFloat(temp);   }catch(Exception e){return "输入字串不是数字串只能包括以下字符('0'~'9','.'),输入字串最大只能精确到仟亿,小数点只能两位!";}
       int len=0;
       if (temp.indexOf(".")==-1) len=temp.length();
       else len=temp.indexOf(".");
       if(len>s4.length()-3) return("输入字串最大只能精确到仟亿,小数点只能两位!");
       int n1,n2=0;
       String num="";
       String unit="";   for(int i=0;i<temp.length();i++){
        if(i>len+2){break;}
        if(i==len) {continue;}
        n1=Integer.parseInt(String.valueOf(temp.charAt(i)));
        num=s1.substring(n1,n1+1);
        n1=len-i+2;
        unit=s4.substring(n1,n1+1);
        result=result.concat(num).concat(unit);
       }
       if ((len==temp.length())||(len==temp.length()-1)) result=result.concat("整");
       if (len==temp.length()-2) result=result.concat("零分");
       return result;
     }
    2、(JSP)
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>转换大写金额</title>
    <STYLE type=text/css>
    INPUT { BORDER-RIGHT: #c0d3dc 1px solid; BORDER-TOP: #c0d3dc 1px solid; BORDER-LEFT: #c0d3dc 1px solid; BORDER-BOTTOM: #c0d3dc 1px solid; font-family: verdana; HEIGHT: 19px}
    BODY {font-family:arial,helvetica,Tahoma; font-size: 9pt; color:'094A82'}
    </STYLE>
    <bgsound id=bgsoundone src="" loop=1>
    </head>
    <body>
    <SCRIPT LANGUAGE="VBScript">            
    dim hj,hji
    sub document_onkeypress()
        if window.event.srcelement.id="num" and window.event.keycode="13" then
       call retu_cn()
    end if
    end sub
    sub window_onload()
    document.fmSubmit.t1.focus()
    end sub
    SUB retu_cn()
    dim n,m_hj,s,ch,ch2,ch3,num
    num=Replace(trim(document.fmSubmit.t1.value),",","",1,-1,1)
    if num="" then
       MsgBox "您还没有输入金额!"
       document.fmSubmit.t1.focus()
       exit sub
    End If
    if IsNumeric(num)=False then
       MsgBox "您输入的不是金额!"
       document.fmSubmit.t1.focus()
       exit sub
    End If
    n=FormatNumber(num,2,-1)
    num=n
    n=Replace(n,",","",1,-1,1)
    If len(n)>15 Then
       MsgBox "金额必须小于千亿!"
       document.fmSubmit.t1.focus()
       exit sub
    End If
    hj=space(0)
    s="840"
    ch="壹贰叁肆伍陆柒捌玖"
    ch2="仟佰拾  "
    ch3="亿万元"
    for x=1 to 3
        m=cstr(int(n/10^FormatNumber(mid(s,x,1),0,-1)))
        m=space(4-len(m))+m
        m_hj=space(0)
        if m<>"   0" then
           for y=1 to 4
               if mid(m,y,1)<>space(1) and mid(m,y,1)<>"0" then
                  m_hj=trim(m_hj+mid(ch,FormatNumber(mid(m,y,1),0,-1),1)+mid(ch2,y,1))
               else
                  if mid(m,y,1)=space(1) or mid(m,y,1)="0" then
                     m_hj=m_hj
                     if right(m_hj,1)="零" then
                        m_hj=m_hj+space(0)
                     else
                        m_hj=m_hj+"零"
                     end if
                  else
                     m_hj=m_hj
                  end if
               end if   
           next
           if right(m_hj,1)="零" then
              m_hj=mid(m_hj,1,len(m_hj)-1)+mid(ch3,x,1)
              if x=3 then
                 m_hj=m_hj+space(0)
              else
                 m_hj=m_hj+"零"
              end if
           else
              m_hj=m_hj+mid(ch3,x,1)
           end if 
           if right(hj,1)="零" and mid(m_hj,1,1)="零" then
              hj=hj+mid(m_hj,2,len(m_hj)-1)
           else
              hj=hj+m_hj
           end if
        else 
           if x=3 then
              if right(hj,1)="零" then
                 if trim(hj)="零" then
                    hj=hj+space(0)
                 else
                    hj=mid(hj,1,len(hj)-1)+"元"
                 end if
              else
                 if trim(hj)="零" then
                    hj=hj+space(0)
                 else
                    hj=hj+"元"
                 end if
              end if
           else
              if right(hj,1)="零" then
                 hj=hj+space(0)
              else
                 hj=hj+"零"
              end if   
           end if   
        end if
        if n-int(n)=0 then
           n=n-int(FormatNumber(m,0,-1))*10^int(FormatNumber(mid(s,x,1),0,-1))
        else
           tt=FormatNumber("0."+mid(cstr(n),Instr(1,n,".")+1,2),2)
           n=int(n) 
           n=n-int(FormatNumber(m,0,-1))*10^int(FormatNumber(mid(s,x,1),0,-1))
           n=n+tt
        end if
    next
      m=mid(cstr(n),2,2)
      if trim(len(m))<>2 then
         m=m+"0"
      end if
      if n*100=0 then
         if left(hj,1)="零" then
            if right(hj,1)="零" then
               hj=hj+"元整"
            else
               hj=mid(hj,2,len(hj)-1)+"整"
            end if
         else
            if right(hj,1)="零" then
               hj=mid(hj,1,len(hj)-1)+"整"
            else
               hj=hj+"整"
            end if
         end if
      else
         if right(hj,1)="零" then
            hj=mid(hj,1,len(hj)-1)
         else
            hj=hj
         end if
         if mid(m,1,1)="0" or mid(m,1,1)=space(1) then
            hj=hj+"零"
         else
            hj=hj+mid(ch,FormatNumber(mid(m,1,1),0,-1),1)+"角"
         end if
         if mid(hj,1,1)="零" then
            hj=mid(hj,2,len(hj)-1)
         else
            hj=hj
         end if
         if mid(m,2,1)="0" then
            hj=hj+"整"
         else
            hj=hj+mid(ch,FormatNumber(mid(m,2,1),0,-1),1)+"分"
         end if   
      end if
    if num=".00" then
       document.fmSubmit.t1.value="0.00"
    else
       document.fmSubmit.t1.value=num
    end if   
    document.fmSubmit.t2.value=""
    hji=1
    call read()
    End Sub
    SUB read()
        MyVar=mid(hj,hji,1)
        document.fmSubmit.t2.value=document.fmSubmit.t2.value+MyVar
        Select Case MyVar
               Case "零"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/0.wav"
               Case "壹"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/1.wav"
               Case "贰"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/2.wav"
               Case "叁"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/3.wav"
               Case "肆"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/4.wav"
               Case "伍"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/5.wav"
               Case "陆"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/6.wav"
               Case "柒"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/7.wav"
               Case "捌"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/8.wav"
               Case "玖"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/9.wav"
               Case "拾"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/10.wav"
               Case "佰"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/b.wav"
               Case "仟"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/q.wav"
               Case "万"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/w.wav"
               Case "亿"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/y.wav"
               Case "元"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/yuan.wav"
               Case "分"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/fen.wav"
               Case "角"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/jiao.wav"
               Case "整"     document.all("bgsoundone").src="http://go.163.com/yjsj/wav/z.wav"
               Case else     hji=0
                             document.all("bgsoundone").src=""
                             exit sub
        End Select
        hji=hji+1
       setTimeout "read",400
    End Sub
    </script>
    最完整、最标准的大写金额转换程序,特别是“零”和“整”的转换,最大金额可到仟亿。     
    <br/>
    并加入了朗读功能,所以说是最完美的大写金额转换程序!
    <br/>
    <form id=fmSubmit name=fmSubmit method="POST">
      <p>请
      

  3.   

    3、(javascript)function ChangeToBig(value)
    {
    var intFen,i;
    var strArr,strCheck,strFen,strDW,strNum,strBig,strNow; if(trim(value)=="")   //数据为空时返回"零"
    return "零";
    if (isNaN(value))   //数据非法时提示,并返回空串
    {
    strErr = "数据"+value+"非法!"
    alert(strErr);
    return "";
    }
    strCheck = value+".";
    strArr = strCheck.split(".");
    strCheck = strArr[0];
    if(strCheck.length>12)   //数据大于等于一万亿时提示无法处理
    {
    strErr = "数据"+value+"过大,无法处理!"
    alert(strErr);
    return "";
    }
    try
    {
    i = 0;
    strBig = "";
    intFen = value*100;          //转换为以分为单位的数值
    strFen = intFen.toString();
    strArr = strFen.split(".");
    strFen = strArr[0];
    intFen = strFen.length;      //获取长度
    strArr = strFen.split(""); //将各个数值分解到数组内
    while(intFen!=0)   //分解并转换
    {
    i = i+1;
    switch(i)              //选择单位
    {
    case 1:strDW = "分";break;
    case 2:strDW = "角";break;
    case 3:strDW = "元";break;
    case 4:strDW = "拾";break;
    case 5:strDW = "佰";break;
    case 6:strDW = "仟";break;
    case 7:strDW = "万";break;
    case 8:strDW = "拾";break;
    case 9:strDW = "佰";break;
    case 10:strDW = "仟";break;
    case 11:strDW = "亿";break;
    case 12:strDW = "拾";break;
    case 13:strDW = "佰";break;
    case 14:strDW = "仟";break;
    }
    switch (strArr[intFen-1])              //选择数字
    {
    case "1":strNum = "壹";break;
    case "2":strNum = "贰";break;
    case "3":strNum = "叁";break;
    case "4":strNum = "肆";break;
    case "5":strNum = "伍";break;
    case "6":strNum = "陆";break;
    case "7":strNum = "柒";break;
    case "8":strNum = "捌";break;
    case "9":strNum = "玖";break;
    case "0":strNum = "零";break;
    } //处理特殊情况
    strNow = strBig.split("");
    //分为零时的情况
    if((i==1)&&(strArr[intFen-1]=="0"))
    strBig = "整";
    //角为零时的情况
    else if((i==2)&&(strArr[intFen-1]=="0"))
    {    //角分同时为零时的情况
    if(strBig!="整")
    strBig = "零"+strBig;
    }
    //元为零的情况
    else if((i==3)&&(strArr[intFen-1]=="0"))
    strBig = "元"+strBig;
    //拾-仟中一位为零且其前一位(元以上)不为零的情况时补零
    else if((i<7)&&(i>3)&&(strArr[intFen-1]=="0")&&(strNow[0]!="零")&&(strNow[0]!="元"))
    strBig = "零"+strBig;
    //拾-仟中一位为零且其前一位(元以上)也为零的情况时跨过
    else if((i<7)&&(i>3)&&(strArr[intFen-1]=="0")&&(strNow[0]=="零"))
    {} 
    //拾-仟中一位为零且其前一位是元且为零的情况时跨过
    else if((i<7)&&(i>3)&&(strArr[intFen-1]=="0")&&(strNow[0]=="元"))
    {}
    //当万为零时必须补上万字
    else if((i==7)&&(strArr[intFen-1]=="0"))
    strBig ="万"+strBig;
    //拾万-仟万中一位为零且其前一位(万以上)不为零的情况时补零
    else if((i<11)&&(i>7)&&(strArr[intFen-1]=="0")&&(strNow[0]!="零")&&(strNow[0]!="万"))
    strBig = "零"+strBig;
    //拾万-仟万中一位为零且其前一位(万以上)也为零的情况时跨过
    else if((i<11)&&(i>7)&&(strArr[intFen-1]=="0")&&(strNow[0]=="万"))
    {}
    //拾万-仟万中一位为零且其前一位为万位且为零的情况时跨过
    else if((i<11)&&(i>7)&&(strArr[intFen-1]=="0")&&(strNow[0]=="零"))
    {}
    //万位为零且存在仟位和十万以上时,在万仟间补零
    else if((i<11)&&(i>8)&&(strArr[intFen-1]!="0")&&(strNow[0]=="万")&&(strNow[2]=="仟"))
    strBig = strNum+strDW+"万零"+strBig.substring(1,strBig.length);
    //单独处理亿位
    else if(i==11)
    {
    //亿位为零且万全为零存在仟位时,去掉万补为零
    if((strArr[intFen-1]=="0")&&(strNow[0]=="万")&&(strNow[2]=="仟"))
    strBig ="亿"+"零"+strBig.substring(1,strBig.length);
    //亿位为零且万全为零不存在仟位时,去掉万
    else if((strArr[intFen-1]=="0")&&(strNow[0]=="万")&&(strNow[2]!="仟"))
    strBig ="亿"+strBig.substring(1,strBig.length);
    //亿位不为零且万全为零存在仟位时,去掉万补为零
    else if((strNow[0]=="万")&&(strNow[2]=="仟"))
    strBig = strNum+strDW+"零"+strBig.substring(1,strBig.length);
    //亿位不为零且万全为零不存在仟位时,去掉万
    else if((strNow[0]=="万")&&(strNow[2]!="仟"))
    strBig = strNum+strDW+strBig.substring(1,strBig.length);
    //其他正常情况
    else
    strBig = strNum+strDW+strBig;
    }
    //拾亿-仟亿中一位为零且其前一位(亿以上)不为零的情况时补零
    else if((i<15)&&(i>11)&&(strArr[intFen-1]=="0")&&(strNow[0]!="零")&&(strNow[0]!="亿"))
    strBig = "零"+strBig;
    //拾亿-仟亿中一位为零且其前一位(亿以上)也为零的情况时跨过
    else if((i<15)&&(i>11)&&(strArr[intFen-1]=="0")&&(strNow[0]=="亿"))
    {}
    //拾亿-仟亿中一位为零且其前一位为亿位且为零的情况时跨过
    else if((i<15)&&(i>11)&&(strArr[intFen-1]=="0")&&(strNow[0]=="零"))
    {}
    //亿位为零且不存在仟万位和十亿以上时去掉上次写入的零
    else if((i<15)&&(i>11)&&(strArr[intFen-1]!="0")&&(strNow[0]=="零")&&(strNow[1]=="亿")&&(strNow[3]!="仟"))
    strBig = strNum+strDW+strBig.substring(1,strBig.length);
    //亿位为零且存在仟万位和十亿以上时,在亿仟万间补零
    else if((i<15)&&(i>11)&&(strArr[intFen-1]!="0")&&(strNow[0]=="零")&&(strNow[1]=="亿")&&(strNow[3]=="仟"))
    strBig = strNum+strDW+"亿零"+strBig.substring(2,strBig.length);
    else
    strBig = strNum+strDW+strBig;
    strFen = strFen.substring(0,intFen-1);
    intFen = strFen.length;
    strArr = strFen.split("");
    }
    return strBig;
    }catch(err){
    return "";      //若失败则返回原值
    }
    }
      

  4.   

    http://www.cn-java.com/forum/show_tree.php?forum_id=2&topic_id=10210&keyword=人民币
      

  5.   

    4、(JAVA)
    public class Money
    {    public Money()
        {
        }
        public static void main(String[] args)
        {
            Money money1 = new Money();
            System.out.println(Money.changeToBig("74329472340.23"));
            System.out.println(Money.changeToBig("072340.20"));
            System.out.println(Money.changeToBig("0.23"));
            System.out.println(Money.changeToBig("700040.03"));
            System.out.println(Money.changeToBig("740.00"));
            System.out.println(Money.changeToBig("100001000.00"));
        }
        public static String changeToBig(String value)
        {
            if(null == value || "".equals(value.trim()))
                return "零";        String strCheck,strArr,strFen,strDW,strNum,strBig,strNow;
            double d = 0;
            try
            {
                d = Double.parseDouble(value);
            }
            catch(Exception e)
            {
                return "数据"+value+"非法!";
            }        strCheck = value+".";
            int dot = strCheck.indexOf(".");
            if(dot > 12)
            {
                return "数据"+value+"过大,无法处理!";
            }        try
            {
                int i = 0;
                strBig = "";
                strDW = "";
                strNum = "";
                long intFen = (long)(d*100);
                strFen = String.valueOf(intFen);
                int lenIntFen = strFen.length();
                while(lenIntFen != 0)
                {
                    i++;
                    switch(i)
                    {
                        case 1:strDW = "分";break;
                        case 2:strDW = "角";break;
                        case 3:strDW = "元";break;
                        case 4:strDW = "拾";break;
                        case 5:strDW = "佰";break;
                        case 6:strDW = "仟";break;
                        case 7:strDW = "万";break;
                        case 8:strDW = "拾";break;
                        case 9:strDW = "佰";break;
                        case 10:strDW = "仟";break;
                        case 11:strDW = "亿";break;
                        case 12:strDW = "拾";break;
                        case 13:strDW = "佰";break;
                        case 14:strDW = "仟";break;
                    }
                    switch (strFen.charAt(lenIntFen-1))              //选择数字
                    {
                        case '1':strNum = "壹";break;
                        case '2':strNum = "贰";break;
                        case '3':strNum = "叁";break;
                        case '4':strNum = "肆";break;
                        case '5':strNum = "伍";break;
                        case '6':strNum = "陆";break;
                        case '7':strNum = "柒";break;
                        case '8':strNum = "捌";break;
                        case '9':strNum = "玖";break;
                        case '0':strNum = "零";break;
                    }
                    //处理特殊情况
                    strNow = strBig;
                    //分为零时的情况
                    if((i==1) && (strFen.charAt(lenIntFen-1) == '0'))
                        strBig = "整";
                    //角为零时的情况
                    else if((i==2)&&(strFen.charAt(lenIntFen-1)=='0'))
                    {    //角分同时为零时的情况
                        if(!strBig.equals("整"))
                            strBig = "零"+strBig;
                    }
                    //元为零的情况
                    else if((i==3)&&(strFen.charAt(lenIntFen-1)=='0'))
                        strBig = "元"+strBig;
                    //拾-仟中一位为零且其前一位(元以上)不为零的情况时补零
                    else if((i<7)&&(i>3)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)!='零')&&(strNow.charAt(0)!='元'))
                        strBig = "零"+strBig;
                    //拾-仟中一位为零且其前一位(元以上)也为零的情况时跨过
                    else if((i<7)&&(i>3)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='零'))
                    {}
                    //拾-仟中一位为零且其前一位是元且为零的情况时跨过
                    else if((i<7)&&(i>3)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='元'))
                    {}
                    //当万为零时必须补上万字
                    else if((i==7)&&(strFen.charAt(lenIntFen-1)=='0'))
                        strBig ="万"+strBig;
                    //拾万-仟万中一位为零且其前一位(万以上)不为零的情况时补零
                    else if((i<11)&&(i>7)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)!='零')&&(strNow.charAt(0)!='万'))
                        strBig = "零"+strBig;
                    //拾万-仟万中一位为零且其前一位(万以上)也为零的情况时跨过
                    else if((i<11)&&(i>7)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='万'))
                    {}
                    //拾万-仟万中一位为零且其前一位为万位且为零的情况时跨过
                    else if((i<11)&&(i>7)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='零'))
                    {}
                    //万位为零且存在仟位和十万以上时,在万仟间补零
                    else if((i<11)&&(i>8)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='万')&&(strNow.charAt(2)=='仟'))
                        strBig = strNum+strDW+"万零"+strBig.substring(1,strBig.length());
                    //单独处理亿位
                    else if(i==11)
                    {
                        //亿位为零且万全为零存在仟位时,去掉万补为零
                        if((strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='万')&&(strNow.charAt(2)=='仟'))
                            strBig ="亿"+"零"+strBig.substring(1,strBig.length());
                        //亿位为零且万全为零不存在仟位时,去掉万
                        else if((strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='万')&&(strNow.charAt(2)!='仟'))
                            strBig ="亿"+strBig.substring(1,strBig.length());
                        //亿位不为零且万全为零存在仟位时,去掉万补为零
                        else if((strNow.charAt(0)=='万')&&(strNow.charAt(2)=='仟'))
                            strBig = strNum+strDW+"零"+strBig.substring(1,strBig.length());
                        //亿位不为零且万全为零不存在仟位时,去掉万
                        else if((strNow.charAt(0)=='万')&&(strNow.charAt(2)!='仟'))
                            strBig = strNum+strDW+strBig.substring(1,strBig.length());
                        //其他正常情况
                        else
                            strBig = strNum+strDW+strBig;
                    }
                    //拾亿-仟亿中一位为零且其前一位(亿以上)不为零的情况时补零
                    else if((i<15)&&(i>11)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)!='零')&&(strNow.charAt(0)!='亿'))
                        strBig = "零"+strBig;
                    //拾亿-仟亿中一位为零且其前一位(亿以上)也为零的情况时跨过
                    else if((i<15)&&(i>11)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='亿'))
                    {}
                    //拾亿-仟亿中一位为零且其前一位为亿位且为零的情况时跨过
                    else if((i<15)&&(i>11)&&(strFen.charAt(lenIntFen-1)=='0')&&(strNow.charAt(0)=='零'))
                    {}
                    //亿位为零且不存在仟万位和十亿以上时去掉上次写入的零
                    else if((i<15)&&(i>11)&&(strFen.charAt(lenIntFen-1)!='0')&&(strNow.charAt(0)=='零')&&(strNow.charAt(1)=='亿')&&(strNow.charAt(3)!='仟'))
                        strBig = strNum+strDW+strBig.substring(1,strBig.length());
                    //亿位为零且存在仟万位和十亿以上时,在亿仟万间补零
                    else if((i<15)&&(i>11)&&(strFen.charAt(lenIntFen-1)!='0')&&(strNow.charAt(0)=='零')&&(strNow.charAt(1)=='亿')&&(strNow.charAt(3)=='仟'))
                        strBig = strNum+strDW+"亿零"+strBig.substring(2,strBig.length());
                    else
                        strBig = strNum+strDW+strBig;
                    strFen = strFen.substring(0,lenIntFen-1);
                    lenIntFen--;
                }
                return strBig;
            }
            catch(Exception e)
            {
                return "";
            }
        }
    }
      

  6.   

    5、(JAVA)
    public String Translate(double ad_je) throws GeneralException {
          String chineseMoney = "";
          String chineseNum;
          String chineseUnit;
          String moneyValue;
          String valueBit;
          String valueTmp = "";      int intp;
          int intp1;
          int intp2;
          int intp3;
          int intnum;      boolean num=true;      Double ld_je;      System.out.println("$$$%$%&%^&"+ad_je);
          System.out.println(dou2Str(ad_je));      if (ad_je >=1000000000000.00||ad_je <= -1000000000000.00){
            throw new GeneralException("err.report.DataOverFlow.Error");     //数据溢出
          }else if(ad_je == 0){
            chineseMoney = "零圆整";
            return chineseMoney;
          }else if(ad_je < 0){
            num = false;
            ad_je = ad_je*(-1);
          }      chineseNum="零壹贰叁肆伍陆柒捌玖";
          chineseUnit="仟佰拾亿仟佰拾万仟佰拾圆角分";      numberFormatter.setGroupingUsed(false);
          numberFormatter.setMinimumFractionDigits(2);      ld_je = new Double(ad_je);
          moneyValue = "$" + numberFormatter.formatDouble(ld_je).trim();
          moneyValue = moneyValue.substring(0,moneyValue.length() - 3) + moneyValue.substring(moneyValue.length()-2,moneyValue.length());      intp=0;
          chineseMoney="";
          for(intp = 0; intp < moneyValue.length(); intp++){
          valueBit = moneyValue.substring(moneyValue.length()-1-intp,moneyValue.length()-intp);
          if (valueBit.equals("$")){
            break;
          }
          intnum = toInt(valueBit);
          chineseMoney = chineseNum.substring( intnum, intnum + 1) + chineseUnit.substring( 13 - intp, 13 - intp + 1) + chineseMoney;
          }
          intp3=chineseMoney.indexOf("零");
          if (intp3 >= 0) {
            if ( chineseMoney.indexOf("零分")>=0) {
              intp2= chineseMoney.indexOf("零分");
              chineseMoney = chineseMoney.substring(0,intp2);
              if (chineseMoney.indexOf("零角")>=0) {
                intp2 = chineseMoney.indexOf("零角");
                chineseMoney = chineseMoney.substring(0,intp2);
              }
            }else{
            if (chineseMoney.indexOf("零角")>=0) {
              intp2= chineseMoney.indexOf("零角");
              chineseMoney = chineseMoney.substring(0,intp2 + 1 ) + chineseMoney.substring(intp2 + 2);
            }
          }
          intp2 = chineseMoney.indexOf("圆");
          if (intp2 >= 0) {
            valueTmp = chineseMoney.substring(intp2);
            chineseMoney = chineseMoney.substring(0,intp2);
            intp2=chineseMoney.length();
            if (chineseMoney.substring(intp2 - 1,intp2).equals("零")) {
              chineseMoney = chineseMoney.substring(0,intp2 - 1);
            }
          }
          //去角分零
          int intc;
          int intc1;
          String strcc;
          Hashtable strww  = new Hashtable();
          intc=1;
          intp1=chineseMoney.indexOf("零");
          while (intp1 >= 0){
            strcc = new Integer(intc).toString().trim();
            if (chineseMoney.substring(intp1,intp1+2).equals("零万")){
              strww.put(strcc,chineseMoney.substring(0,intp1)+chineseMoney.substring(intp1 + 1,intp1 + 2));
            }else {
              if (chineseMoney.substring(intp1,intp1+2).equals("零亿")){
                strww.put(strcc,chineseMoney.substring(0,intp1)+chineseMoney.substring(intp1 + 1,intp1 + 2));
              }else{
                strww.put(strcc,chineseMoney.substring(0,intp1 + 1));
              }
            }
            if (chineseMoney.length() > intp1 + 2){
              chineseMoney = chineseMoney.substring(intp1 + 2);
            }else
            {
              chineseMoney="";
            }
            intp1 = chineseMoney.indexOf("零");
            intc = intc + 1;
          }
          intc1=1;
          String strwww = "";
          while (intc1< intc) {
            strcc = new Integer(intc1).toString().trim();
            strwww = strwww + (String)strww.get(strcc);
            intc1  = intc1+1;
          }
          chineseMoney = strwww + chineseMoney + valueTmp;
          while (chineseMoney.indexOf("零零")>=0) {
            intp1 = chineseMoney.indexOf("零零");
            chineseMoney = chineseMoney.substring(0,intp1) + chineseMoney.substring(intp1 + 1);
          }
          intp1 = chineseMoney.indexOf("零圆");
          if (intp1>= 0){
            chineseMoney = chineseMoney.substring(0,intp1) + "零" + chineseMoney.substring(intp1 + 1);
          }
          if (chineseMoney.indexOf("分") < 0){
            chineseMoney = chineseMoney + "整";
          }
        }
        intp = chineseMoney.indexOf("零圆");
        if (intp>=0){
        chineseMoney = chineseMoney.substring(0,intp) + chineseMoney.substring(intp + 1);
        }
        intp = chineseMoney.indexOf("零万");
        if (intp>=0){
          chineseMoney = chineseMoney.substring(0,intp) + chineseMoney.substring(intp + 1);
        }
        intp = chineseMoney.indexOf("零亿");
        if (intp>=0){
          chineseMoney = chineseMoney.substring(0,intp) + chineseMoney.substring(intp + 1);
        }
        intp = chineseMoney.indexOf("亿万");
        if (intp>=0){
          chineseMoney = chineseMoney.substring(0,intp + 1) + chineseMoney.substring(intp + 2);
        }
        if (chineseMoney.substring(0,1).equals("圆")){
          chineseMoney = chineseMoney.substring(1);
          if (chineseMoney.substring(0,1).equals("零")){
            chineseMoney = chineseMoney.substring(1);
          }
        }
        if(num){
          return chineseMoney;
        }else{
          chineseMoney = "负"+chineseMoney;
          return chineseMoney;
        }
      }
    class NumberFormatter {
        NumberFormat formatter = NumberFormat.getNumberInstance();
        public NumberFormatter() {
          formatter.setParseIntegerOnly(false);
        }
        public String formatDouble(double value) {
          return formatter.format(value);
        }
        public String formatDouble(Double value) {
          return formatter.format(value.doubleValue());
        }
        public String formatFloat(float value) {
          return formatter.format(value);
        }
        public String formatFloat(Float value) {
          return formatter.format(value.floatValue());
        }
        public String formatInteger(int value) {
          return formatter.format(value);
        }
        public String formatInteger(Integer value) {
          return formatter.format(value.intValue());
        }
        public String formatDate(Date value) {
          return DateFormat.getDateInstance().format(value);
        }
        public String formatLong(long value) {
          return formatter.format(value);
        }
        public String formatLong(Long value) {
          return formatter.format(value.longValue());
        }
        public void setGroupingUsed(boolean right) {
          formatter.setGroupingUsed(right);
        }
        public void setMinimumFractionDigits(int bits) {
          formatter.setMinimumFractionDigits(bits);
        }
      }