Capital | process | Chinese Character | amount | lowercase
Write yourself a relatively ugly program, but do the report when useful
/********************************************************************
Time: 2003.7.31
Author: Trinidad Pig
Function: Converts currency digits (Arabic numerals) (lowercase) into Chinese (uppercase)
Parameter: num is character type, leaving two digits after the decimal point, for example: Arabia_to_chinese ("1234.06")
Note: 1. At present this conversion only support to pick billion (yuan) bit, the amount of units for the yuan, can not be million, the smallest unit for the minute
2. Negative numbers are not supported
Modify Area
Time:
Modify Person:
Reason:
End of modification area
********************************************************************/
function Arabia_to_chinese (Num) {
for (i=num.length-1;i>=0;i--)
{
Num = Num.replace (",", "")//Replace the "," in Tomoney ()
Num = Num.replace ("", "")//Replace the space in Tomoney ()
}
Num = Num.replace ("¥", "")//replace the possible ¥ characters
if (isNaN (Num)) {//Verify that the character entered is a number
Alert ("Please check the lowercase amount is correct");
Return
}
---character processing finished, start conversion, conversion using the two parts of the conversion---//
Part = String (Num). Split (".");
Newchar = "";
Convert before a decimal point
for (i=part[0].length-1;i>=0;i--) {
if (Part[0].length >) {alert ("too large to compute"); return "";} If the number of more than million units, prompted
Tmpnewchar = ""
Perchar = Part[0].charat (i);
Switch (Perchar) {
Case "0": tmpnewchar= "0" + Tmpnewchar;
Case "1": tmpnewchar= "one" + Tmpnewchar;
Case "2": tmpnewchar= "II" + Tmpnewchar;