Home >Web Front-end >JS Tutorial >JS implements sample code to convert RMB amount to uppercase_javascript skills

JS implements sample code to convert RMB amount to uppercase_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:00:141394browse
Copy code The code is as follows:

//JavaScript version of the RMB amount to uppercase program 
//CopyRight Bardo QI                                                                                                                                                                                                   ‐                                                                                    . ['jiao','fen',''], 4:['qian','hundred','shi','']};                                                                                                   DUvar var capNum=['zero','一','二' ','三','四','五','鲁','撒','八','玖']; 
 if (((num.toString()).indexOf('.' ) > 16)||(isNaN(num)))
return '';
num = (Math.round(num*100)/100).toString();
num =(( Math.pow(10,19-num.length)).toString()).substring(1) num; 
 var i,ret,j,nodeNum,k,subret,len,subChr,CurChr=[];
for (i=0,ret='';i<5;i ,j=i*4 Math.floor(i/4)){
nodeNum=num.substring(j,j 4);
for(k=0,subret='',len=nodeNum.length;((k CurChr [k%2] = capNum[nodeNum.charAt(k)] ((nodeNum.charAt(k)==0)?'':capDigit[len][k]);  
    if (!((CurChr[ 0]==CurChr[1]) && (CurChr[0]==capNum[0]))) 
      if(!((CurChr[k%2] == capNum[0]) && (subret== '') && (ret=='')))
subret = CurChr[k%2];
} }
subChr = subret ((subret=='')?'':capUnit[i ]);
if(!((subChr == capNum[0]) && (ret=='')))
ret = subChr;
} ret=(ret==' ')? capNum[0] capUnit[3]: ret;
return ret;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn