First write a function on the ASP version and JavaScript version of RMB uppercase transformation, now share C # version. RMB.CS
Using
System;
Namespace
Test
{/ ** //// /// RMB summary description. /// summary> public class RMB {/ ** //// /// converts RMB size amount /// summary> /// amount param > /// Returns in the upper business returns> public static string cmycurd (decimal num) {string str1 = "Zero Zi Zi Wei Lu Yu"; // 0-9 Corresponding Chinese characters String STR2 = "Wan Yiyi picks up hundreds of millions of 佰 万 万 万 佰 分"; // The Chinese character str3 = ""; / / from the original NUM value String str4 = ""; / / Digital string form string str5 = ""; // RMB uppercase amount INT i; // cyclic variable INT j; // Num value multiply by 100 string length String ch1 = ""; // number Chinese Reading String CH2 = ""; // Digital Bits of Chinese Character Reading INT NZERO = 0; // Used to calculate a continuous zero value is a few int TEMP; // Num = Math from the original NUM value .Round (Math.Abs (NUM), 2); // Take Num to take the Num and take 2 digits STR4 = ((Num * 100)). Tostring (); // Take NUM 100 and Convert into string form j = str4.Length; // to find the highest bit IF (j> 15) {return "overflow";} str2 = Str2.substring (15-j); // Remove the value of the STR2 of the corresponding bit.
Such as: 200.55, J is 5, so str2 = 元 元 分 // Remove each bit to convert the value for converting for conversion for (i = 0; i
} Else {IF (STR3! = "0" && nzero == 0) {CH1 = str1.substring (Temp * 1, 1); CH2 = str2.substring (i, 1); NZERO = 0;} else {IF (STR3 == "0" && Nzero> = 3) {CH1 = ""; CH2 = "" "; NZERO = NZERO 1;} else {IF (j> = 11) {CH1 =" "; NZERO = NZERO } Else { ch1 = ""; ch2 = str2.Substring (i, 1); nzero = nzero 1;}}}}} if (i == (j-11) || i == (j-3)) {/ / If this bit is a billion or a ballad, you must write CH2 = str2.substring (i, 1);} STR5 = STR5 CH1 CH2; IF (i == J-1 && str3 =