This function is very different from the structure provided by other netizens. It is an algorithm from high to low, more in line with language habits.
/ / -------------------------------------------------------------------------------------------- ------------------------ // Currency Digital Convert to Chinese uppercase function, the integer part is up to 16 digits, that is, "Gigabit" // -------------------------------------------------- --------------------- Ansistring __fastcall tfineInvoice :: MoneyTochineseChar (currency money) {static char * chinanumberchar [10] = {"zero", "", " "," "," "," Wu "," Lu "," 柒 "," 捌 "," "}; static char * chinaunitchar [4] = {" 兆 "," 100 million "," Wan "," meta "}; static char * ChinaBitChar [3] = {" thousand "," Bai "," pick up "}; AnsiString expDecimal =" 00 "; AnsiString expInteger = MoneyValue; AnsiString expChinese =" "; AnsiString expNumber , expmoney; INT INTBIT; // Split an integer and decimal IF (expinteger.pos (".") {expdecimal = expressger.substring (expressger.pos (".") 1, 2) "00"; Expinteger .SETLENGTH (".") - 1); Expdecimal.setLength (2);} // Processing negative IF (expinteger.substring (1, 1) == "-") {ExpChinese = "(negative number ) "; Expression, 1, 1);} // handle integer part For (int i = 16-expressionger.Length (); i <16; i ) {expNumber = ""; expmoney = ""; intbit = expressger.substring (1) .tointdef (0); if (INTBIT | | (expMoney.Length () && i% 4 <3)) expNumber = ChinaNumberChar [intBit]; if (i% 4 == 3) expMoney = ChinaUnitChar [i / 4]; else if (intBit) expMoney = ChinaBitChar [i % 4]; if (INTBIT ==
0 && i% 4 == 3 && Expherse.substring (ExpChinese.Length () - 1, 2) == "zero") ExpChinese.setLength (ExpChinese.Length () - 2); ExpChinese = evNumber EXPMONEY; Expinteger . Delte (1, 1);} // Processing the decimal part IF (expdecimal.TointDef (0)) {INTBIT = expdecimal.substring (1, 1) .toinTdef (0); if (intbit) {ExpChinese = chinanumberchar [ INTBIT]; ExpChinese = "angle";} intbit = expdecimal.substring (2, 1) .toinTdef (0); if (intbit) {if (ExpChinese.Substring (ExpChinese.Length () - 1, 2) == "Yuan") ExpChinese = "zero"; ExpChinese = chinanumberchar [intbit]; ExpChinese = "points";} else Expchinese = "whole"; // This "whole" said unnecessary!} Else Expchinese = "Whole"; return expchinese;} // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------- The following programs are not in use (Borland C ), there is no problem. Ansistring __fastcall tform_vip :: DX (float xx) // Gold 金 lowercase = "Zero 壹 贰 柒捌 柒捌"; ANSISTRING DANWEI = "Personal angle Pick up 100,000 100 billion billion "" Ansistring XXSTR = Formatfloat ("0.00", XX), DXSTR = ""; for (int i = xxstr.length (); i> = 1; I -) {ix (xxstr.substring (i, 1)! = ".") DXSTR = shuzi.substring (STRTOINT (XxStr.Substring (i, 1)) * 2 1, 2) Trim (Danwei.Substring ((xxstr.length () - i ) * 4, 4)) DXSTR;} Return DXSTR;