Transform the amount of lowercase into Chinese characters

zhaozj2021-02-12  177

A more ugly program written by yourself, but it is useful / ****************************************************** ********************************* time: 2003.7.31 author: Trinidad pig function: digital Currency (Arabic numerals ) (Lowercase) Transformation into Chinese (capital) Parameters: NUM is a character pattern, and two digits after the decimal point, an example: Arabia_to_CHINESE ("1234.06") Description: 1. This conversion only supports picking 100 million (yuan), amount unit Yuan Yuan, can not be 10,000 yuan, the minimum unit is divided 2. No negative modification area

Time: Modify: Cause:

The modification area ends ****************************************************** ********************* / FUNCTION ARABIA_TO_CHINESE (NUM) {for (i = Num.length-1; I> = 0; I -) {Num = Num.Replace (",", ") // Replace Tomoney ()", "Num = Num.Replace (" ") // Replace the space in Tomoney ()} Num = Num.Replace "¥", "") // Replace the possible {// verify that the input characters are digital ALERT ("Please check if the lowercase amount is correct"); Return;} // --- Character processing, start conversion, conversion with two parts of the two parts. Split ("."); Newchar = ""; // For the decimal point = Part [0] .length-1; i> = 0; i -) {if (part [0] .length> 10) {alert ("The number of bits is too large, can't calculate"); return ""; // If the quantity exceeds picking up the unit, TmpNewchar = "" Perchar = part [0] .Charat (i); switch (perchar) {copy "0": tmpnewchar = "zero" tmpnewchar; break; casse "1" : tmpnewchar = "" tmpnewchar; breaf; case "2": tmpnewchar = "" tmpnewchar; break; case "3": tmpnewchar = "" tmpnewchar; break; casse "4": tmpnewchar = " " TmpNewcha;" 5 ": tmpnewchar =" Wu " TmpNewcha; Break; Case" 6 ": tmpnewchar =" Lu " TmpNewchar; Break; Case" 7 ": tmpnewchar =" 柒 " tmpnewchar; Break Case "8": TmpNewchar = "捌" TmpNewcha; Break; Case "9": tmpnewchar = "" TmpNewChar; Break;} switch (part [0] .length-i-1) {cas 0: tmpnewchar = tmpnewchar "yuan" Break; Case 1: IF (Perchar! = 0) TmpNewchar = TmpNewcha "Pick"; Break; Case 2: IF (Perchar! = 0) TmpNewchar =

Tmpnewchar ""; break; case 3: if (Perchar! = 0) TmpNewchar = tmpnewchar "仟"; Break; Case 4: TmpNewchar = TmpNewchar "10,000"; Break; Case 5: IF (Perchar! = 0 ) tmpnewchar = tmpnewchar "Pick up"; Break; Case 6: IF (Perchar! = 0) TmpNewchar = TmpNewchar ""; Break; Case 7: IF (Perchar! = 0) TmpNewchar = TmpNewchar "仟"; BREAK Case 8: tmpnewchar = tmpnewchar "hundreds"; Break; Case 9: tmpnewchar = tmpnewchar "Pick"; Break;} newchar = tmpnewchar newchar;} // Decimal point after conversion IF (Num.indexof ("." )! = - 1) {IF (part [1] .length> 2) {Alert ("The two digits can only be retained after the decimal point, the system will automatically"); part [1] = part [1] .substr 0, 2)} for (i = 0; i

Newchar tmpnewchar;}} // Replace all useless Chinese characters while (newchar.search ("zero zero")! = -1) newchar = newchar.replace ("zero zero", "zero"); newchar = newchar.Replace "零", "hundreds"); newchar = newchar.replace ("100 million", "hundreds"); newchar = newchar.replace ("万", "10,000"); newchar = newchar.replace ("zero Yuan, "yuan"); newchar = newchar.replace ("zero", ""); newchar = newchar.replace ("zero", ""); if (newchar.charat (newchar.length-1) == "Yuan" || Newchar.Charat (newchar.length-1) == "angle") newchar = newchar "whole" return newchar;}

转载请注明原文地址:https://www.9cbs.com/read-6170.html

New Post(0)