Convert the amount of the amount to uppercase and English

zhaozj2021-02-16  60

Convert the amount of the amount into uppercase and English xiaxilin [original] Keyword amount converted to use system; namespace changeMoney {///

/// ChangeMAGEManage's summary description.

/// public class changingmoneyclass {public static string MoneyToeng (String n) {// String result = ""; string m = getfloat (n); string strfloat = "point" m.replace ("0" , "Zero"). Replace ("1", "one"). Replace ("2", "Two"). Replace ("3", "Three"). Replace ("4", "FOUR"). Replace ("5", "FIVE"). Replace ("6", "Six"). Replace ("7", "seven"). Replace ("8", "EIGHT"). Replace ("9", "nine"); string [] b = new string [6]; int i = 0; double t = double.parse (n); if (Getinteger (n) == "0") {b [0] = " ZERO ";} // for (i = 0; T> = 1000.0; i ) else {DO {INT K = int.parse (GetInteger (T.TOString ()))% 1000; B [i] = GetNum3 (K ); T = T / 1000.0; IF (int.Parse (Getinteger ()) <1000 & int.Parse (GetInteger ())> 0) {switch (i) {cas 0 : IF (k! = 0) {b [i] = getnum3 (int.parse (T. Tostring ()))))))))) "THOUSAND AND" B [I];} else {b [i] = getnum3 (INT.PARS (GetInteger (T. Tostring ()))))) "THOUSAND" B [I]; } Break; Case 1: IF (k! = 0) {b [i] = getnum3 (int.pars ")))) " Million and " b [i];} else {B [I] = getnum3 (INT.PARS (T. Tostring ())))) "Million" B [i];} Break; Case 2: IF (k! = 0) {b [i] = getnum3 (int.parse (GetInteger (T. Tostring ())))))

Billion and " b [i];} else {b [i] = getNum3 (Getinteger (GetInteger ())))) " Billion " B [i];} Break; Case 3: IF (k! = 0) {b [i] = getnum3 (INTINTEGER (GetInteger (T. Tostring ()))))) "Trillion and" B [I];} else {b [i] = getnum3 (int Num3 .PARSE (GetInteger ()))))))) "Trillion" B [I];} Break; default: b [i] = "The number is to lad !!!";}} else (int.Parse (T. Tostring ())> = 1000) {Switch (i) {casse 0: b [i] = "thousand" b [i]; break; case 1: b [i] = "Million" B [I]; Break; Case 2: B [I] = "Billion" B [I]; Break; Case 3: B [i] = "trillion" b [i]; break; Default: b [i] = "The number is to lad !!!"; break;}} // While (i> = 0) // {// Result = result b [i]; // i - ; //} i ;} whil e (t> = 1000.0);} // returnrate; return b [5] b [4] b [3] b [2] b [1] b [0] strfloat; // 0 -999} private static string getnum3 (int N) {string m = n.to.tostring (); string [] b = new string [3]; string str = ""; if (n> = 100 & n <1000) { B [0] = m.substring (0, 1). Replace ("0", ""). Replace ("1", "one hundred") .Replace ("2", "Two Hundred") .replace ( "3", "Three Hundred") .Replace ("4", "Four Hundred"

.Replace ("5", "FIVE HUNDRED") .Replace ("6", "Six Hundred") .Replace ("7", "Seven Hundred") .Replace ("8", "Eight Hundred"). Replace ("9", "nine hundred"); if (m.substring (1, 1) == "1") {str = m.substring (1, 2). Repece ("10", "and Ten" ) .Replace ("11", "and eleven") .Replace ("12", "and Twelve") .Replace ("13", "and thirteen") .Replace ("14", "and fourteen"). Replace ("15", "and fifteen") .Replace ("16", "and Sixteen") .replace ("17", "and seventeen") .Replace ("18", "and ele h") .REPLACE "19", "and nineteen");} else if (m.substring (1, 1) == "0") {str = m.substring (1, 2). Repece ("00", "). Replace ("01", "and one") .Replace ("02", "and two") .Replace ("03", "and three") .Replace ("04", "and four") .replace ( "05", "and FIVE") .Replace ("06", "and Six") .replace ("07", "and seven") .replace ("08", "and ele h) .replace (" 09 "," and nine ");} else {b [1] = m.substring (1, 1) .Replace (" 2 "," and twenty) .replace ("3", "and thirty") .replace ("4", "and forty") .Replace ("5", "and fifty") .replace ("6", "and limited") .rep LACE ("7", "and severage") .Replace ("8", "and EIGHTY") .Replace ("9", "and ninty"); b [2] = m.substring (2, 1). Replace ("0", ""). Replace ("1", "- one"

) .Replace ("2", "- two") .replace ("3", "- three") .Replace ("4", "- four") .Replace ("5", "- five"). Replace ("6", "- Six") .replace ("7", "- seven") .Replace ("8", "- eleght") .Replace ("9", "- nine"); str = B [1] B [2];}} else if (n <100 & n> = 10) {B [0] = ""; if (M.Substring (0, 1) == "1") { Str = m.substring (0, 2) .replace ("10", "ten") .Replace ("11", "Eleven") .replace ("12", "twelve") .Replace ("13", "thirteen") .Replace ("14", "fourteen") .replace ("15", "fifteen") .Replace ("16", "sixteen") .replace ("17", "seventeen") .replace ("18", "EIGHTEEN") .Replace ("19", "nineteen");} else {b [1] = m.substring (0, 1) .replace ("2", "twenty") .replace ("3", "Thirty") .Replace ("4", "forty") .Replace ("5", "fifty") .Replace ("6", "sixty") .replace ("7", " ") .Replace (" 8 "," eighty ") .replace (" 9 "," ninty "); b [2] = m.substring (1, 1) .Replace (" 0 ","). Replace ("1", "- one") .replace ("2", "- two") .Replace ("3", "- three") .Replace ("4", "- four") .replace ( "5", "- FIVE") .Replace ("6", "- Six") .replace ("7", "- seven") .replace ("8", "- Eight ") .Replace (" 9 "," - nine "); str = b [1] b [2];}} else if (n> = 0 & n <

10) {B [0] = ""; B [1] = ""; B [2] = m.substring (0, 1) .Replace ("0", "). Replace (" 1 "," One ") .Replace (" 2 "," Two ") .Replace (" 3 "," Three ") .Replace (" 4 "," FOUR ") .Replace (" 5 "," FIVE ") .replace ( "6", "Six") .replace ("7", "seven") .replace ("8", "limited") .Replace ("9", "nine"); str = B [1] B [2];} RETURN B [0] Str;} private static string getinteger (string n) {string [] a; a = n.split ('.'); String s = a [0]; returnz } Private static string getfloat (String n) {if (N.Replace ("0", "). Replace (" 1 ","). Replace ("2", "). Replace (" 3 ", "") .Replace ("4", "). Replace (" 5 ","). Replace ("6", "). Replace (" 7 ","). Replace ("8", "") .Replace ("9", "") == "" "{n = n ". 0 ";} String [] A; a = n.split ('.'); String s = a [1 ]; Return S;} public static string getMoneystr (double number) // total {try {string m_point = "round"; string m_sign; int m_len; // int G_max = 20; int g_dec = 4; string m_srcint; string m_srcdec String m_retv = ""; int m_cntr = 0; string m_decstr; if (Num> = 0.00) {M_sign = "";} else {m_sign = "negative"; Num = Num * (- 1);} m_srcint = Num.toString (). Trim (); // m_srcint - "String [] s_cut = m_srcint.split (new char [] {'.'}); if (s_cut.length ==

2) {IF (s_cut [0] .tostring (). Trim (). Length> 15) {m_retv = m_sign m_retv m_srcint "Translation failed!"; Return m_retv;} if (s_cut [1] .tostring () .Trim (). Length> 4) {m_srcint = m_srcint.substring (0, m_srcint.Length- (s_cut [1] .tostring (). Trim (). Length-4);}} else f (s_cut.length == 1) {m_srcint = m_srcint ". 0000";} else {return num.tostring () "Conversion Failed!";} S_cut = m_srcint.split (new char [] {'.'}, 2); m_srcdec = S_CUT [1] .tostring (). Trim (); m_srcdec = m_srcdec "0000"; m_srcdec = m_srcdec.substring (0, 4); m_srcint = s_cut [0] .tostring (). Trim (); m_len = m_srcint .Length; string m_chr, m_last = "", m_this = "", m_cnzero = Num2cn ("0"), m_cnname, m_lbase, m_tbase = len2cnbase (m_len); m_lbase = m_tbase; for (m_cntr = 1; m_cntr <= m_len ; m_cntr ) {m_chr = m_srcint.Substring (m_cntr-1,1); m_this = Num2cn (m_chr); m_cnname = Len2cnname (m_len-m_cntr 1); m_tbase = Len2cnbase (m_len-m_cntr 1); if (m_lbase = = m_tbase) {IF (m_last == m_c Nzero && m_this == m_cnzero) {} else {if ((m_this == m_cnzero)) m_retv = m_retv m_this "" "; else m_retv = m_retv m_this m_cnname;}} else {if (m_retv.length> = 2) {IF (m_retv.substring (m_retv.length-2, 2) == m_cnzero) {m_retv = m_retv.substring (0, m_retv.length-2); m_last = "";}} m_retv = m_retv m_lbase; if ( m_last == m_cnzero &

& m_this == m_cnzero) {} else {if ((m_this == m_cnzero)) m_retv = m_retv m_this "" "" "; ELSE M_RETV = M_RETV M_THIS M_CNNAME;}} m_lbase = m_tbase; m_last = m_this;} if (m_retv .Length-2> = 0) {IF (m_retv.substring (m_retv.length-2, 2) == m_cnzero) {m_retv = m_retv.substring (0, m_retv.length-2);}} m_retv = m_retv m_point ; M_DECSTR = ""; if (Double.Parse (m_srcdec) == 0) {if (m_point == "circle") m_retv = m_retv "whole"; else m_retv = m_retv "";} else {m_len = g_dec; m_this = ""; M_last = ""; for (m_cntr = m_len; m_cntr> 0; m_cntr -) {m_chr = m_srcdec.substring (m_cnTr-1, 1); m_this = Num2cn (m_chr); if (m_point == " Circle ") {m_cnname = jedec (m_cntr); if (m_this == m_cnzero && null == m_decstr) {} else {if (m_last == m_cnzero && m_this == m_cnzero) {} else {if (m_this == m_cnzero) M_Decstr = m_this " m_decstr; ELSE m_decstr = m_this m_cnname m_decstr;}}} else {m_cnname = ""; if (m_this == m_cnzero && null == m_decstr) {} else m_decstr = m_this m_decstr;} m_last = m_this;}} string myretu = m_sign m_retv m_decstr; if (Myretu.Substring (Myretu.length-1, 1) == "Zero"

) Return myretu.substring (0, myretu.length-1); else return}} catch {return num.tostring () "Conversion failed!";}} #Region 1 - "Corner" 2 - "points "Private Static String Jedec (int NUM) {String Retu =" "; switch (num) {case 1: RETU =" angle "; Break; case 2: retu =" division "; break; case 3: retu ="% "; Break; Case 4: RETU =" "; break; default: retu =" "; break;} return retu;} #endregion #region CN> = 14 && cn <= 19--" trigue "Private Static String Len2cnbase (int CN) {String RETU = ""; if (CN> = 14 && CN <= 19) {RETU = "mega";} else if (cn> = 9 && cn <= 13) {RETU = "100 million "} Else if (CN> = 5 && CN <= 8) {RETU =" 10,000 ";} else {RETU ="} else {RETU = "N / A";} return Retu;} #endregion #region 1 - "" ", 2 -" Picking "Private Static String Len2cnname (int LEN) {String Retu =" "; Switch (LEN) {Case 1: RETU =" ""; Break; Case 2: RETU = "Pick up"; Break; Case 3: Retu = ""; Break; Case 4: RETU = "仟"; Break; Case 5: RETU = ""; Break; Case 6: Retu = "Pick up"; Break; Case 7: Retu = ""; Break; Case 8: Retu = "仟" Break; Case 9: RETU = ""; Break; Case 10: Retu = "Pick"; Break; Case 11: Retu = ""; Break; Case 12: RETU = "仟";

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

New Post(0)