/// <Summary> /// converts a number into a corresponding high-cost value. /// </Summary> /// <Param name = "strdigital"> </param> // <returns> Conversion Result </returns> Public String zhuanhuan (string strdigital) {string ret; decimal dshuzi; dshuzi = decimal. parse (strdigital); If (dshuzi = 0) {ret = "Zero RMB"; return ret;} string je = dshuzi. tostring ("####. 00 "); If (JE. length> 15) Return ""; je = new string ('0', 15-je. length) + je; // if the value is smaller than 1 5 characters long. Fill in 0 string stry = je. substring (0, 4); // obtain the string strw = je. substring (4, 4); // obtain the 'wan' unit string strg = je. substring (8, 4); // obtain the 'meta' unit string STRF = je. substring (13, 2); // obtain the decimal part string str1 = "", str2 = "", str3 = ""; str1 = This. getupper (stry, ""); // an uppercase str2 of hundreds of millions of Units = This. getupper (strw, "Ten Thousand"); // uppercase str3 of the ten thousand units = This. getupper (strg, ""); // uppercase string str_y = "", str_w = ""; if (JE [3] = '0' | je [4] = '0') // 0 str_y = "0" between million and million "; if (JE [7] = '0' | je [8] = '0') // whether there is 0 str_w = "0" between the dollar and the dollar "; ret = str1 + str_y + str2 + str_w + str3; // combine the three uppercase values of hundreds of millions of yuan (INT I = 0; I <ret. length; I ++) // remove the previous "zero" {If (Ret [I]! = '0') {ret = ret. substring (I); break ;}} for (INT I = ret. length-1; I>-1; I --) // remove the last "zero" {If (Ret [I]! = '0') {ret = ret. substring (0, I + 1); break;} If (Ret [ret. Length-1]! = 'Meta') // if the last digit is not 'meta', add a 'meta' ret = RET + ""; if (ret = "zero element") // if it is zero, the "number of elements" is removed. As long as the decimal part ret = ""; if (STRF = "00 ") // convert the decimal part {ret = RET + "integer";} else {string TMP = ""; TMP = This. getint (STRF [0]); If (TMP = "0") ret = RET + TMP; else ret = RET + TMP + ""; TMP = This. getint (STRF [1]); If (TMP = "0") ret = RET + "whole"; else ret = RET + TMP + "points ";} if (Ret [0] = '0') {ret = ret. substring (1); // prevents 0. 03 convert to "0: 3", and directly convert to "3: 5"} return ret; // complete, return} // <summary> // convert a unit to uppercase, for example, hundreds of millions of units, tens of thousands of units, and units /// </Summary> /// <Param name = "str"> lowercase Number of the Unit (4-digit long, if not enough, then add zero) </param> // <Param name = "strdw">, meta </param> // <returns> Conversion Result </returns> private string getupper (string STR, string strdw) {If (STR = "0000 ") return ""; string ret = ""; string tmp1 = This. getint (STR [0]); string tmp2 = This. getint (STR [1]); string tmp3 = This. getint (STR [2]); string tmp4 = This. getint (STR [3]); If (tmp1! = "Zero") {ret = RET + tmp1 + "percent";} else {ret = RET + tmp1;} If (tmp2! = "0") {ret = RET + tmp2 + "success";} else {If (tmp1! = "Zero") // ensure that if there are two zeros '00', the result will only be zero, the same as ret = RET + tmp2;} If (tmp3! = "0") {ret = RET + tmp3 + "pick up";} else {If (tmp2! = "0") ret = RET + tmp3;} If (tmp4! = "0") {ret = RET + tmp4;} If (Ret [0] = '0') // if the first character is '0 ', remove ret = ret. substring (1); If (Ret [ret. length-1] = '0') // if the last character is '0', remove ret = ret. substring (0, Ret. length-1); return ret + strdw; // Add the unit} // <summary> // convert a single number to uppercase /// </Summary> /// <Param name = "C"> lowercase arabic numerals 0---9 </param> // <returns> upper case number </returns> private string getint (char C) {string STR = ""; Switch (c) {Case '0': Str = "zero"; break; Case '1': Str = "one"; break; case '2': Str = "two"; break; Case '3': Str = "three"; break; Case '4': Str = "Si"; break; case '5': Str = "Wu"; break; Case '6': Str = "Lu"; break; Case '7': Str = "yellow"; break; case '8': Str = "break"; break; Case '9': Str = "break"; break;} return STR ;}