1 /// <summary>2 ///Digital to uppercase3 /// </summary>4 /// <param name= "type" >Unit Price/Quantity</param>5 /// <param name= "Num" >Digital</param>6 /// <returns></returns>7 Public Static stringGetchinesenum (stringTypestringNum)8 {9 #regionTen Try One { A stringm_1, M_2, M_3, M_4, m_5, M_6, m_7, M_8, M_9; -M_1 =Num; - stringNumnum ="0123456789."; the stringNumchina ="0 One and three Woolu Qi Ba nine points"; - stringNumchinaweigh ="Pick Bai thousand thousand thousand hundred million to pick up hundred thousand million"; - if(Num.substring (0,1) =="0")//0123-->123 -Num = num.substring (1, num.length-1); + if(! Num.contains ('.')) -Num + =". XX"; + Else//123.234 123.23 123.2 ANum = num.substring (0, Num.indexof ('.') +1+ (Num.split ('.')[1]. Length >2?3: Num.split ('.')[1]. Length)); atM_1 =Num; -M_2 =m_1; -M_3 = M_4 =""; - //m_2:1234-> One and three restaurants - for(inti =0; I < One; i++) - { inM_2 = M_2.replace (numnum.substring (i,1), numchina.substring (I,1)); - } to //m_3: Bai bai thousand to pick up a + intIlen =m_1.length; - if(M_1.indexof ('.') >0) theIlen = M_1.indexof ('.');//get the integer number of digits * for(intj = Ilen; J >=1; j--) $M_3 + = numchinaweigh.substring (J-1,1);Panax Notoginseng //M_4:2 line +3 line - for(inti =0; i < m_3.length; i++) theM_4 + = m_2.substring (i,1) + m_3.substring (i,1); + //m_5:4 go to "0" and pick up the Hundred thousand . AM_5 =M_4; theM_5 = M_5.replace ("0 Pick up","0"); +M_5 = M_5.replace ("0 Bai","0"); -M_5 = M_5.replace ("0 Thousand","0"); $ //m_6:00-> 0,000-> 0 $M_6 =m_5; - for(inti =0; i < Ilen; i++) -M_6 = M_6.replace ("00","0"); the //m_7:6, million, digit "0" -M_7 =m_6;WuyiM_7 = M_7.replace ("billion zero million","billion Zero"); theM_7 = M_7.replace ("billion zero million","billion Zero"); -M_7 = M_7.replace ("0","billion"); WuM_7 = M_7.replace ("0","million"); - if(M_7.length >2) AboutM_7 = M_7.replace ("0 x","a"); $ //M_8:7 Line +2 decimal number -M_8 =m_7; -M_8 = M_8.replace ("a",""); - if(M_2.substring (M_2.length-3,3) !="Point 00") AM_8 + = m_2.substring (M_2.length-3,3); + //M_9:7 Line +2-line fractional-Price theM_9 =m_7; -M_9 = M_9.replace ("a","round"); $ if(M_2.substring (M_2.length-3,3) !="Point 00") the { theM_9 + = m_2.substring (M_2.length-2,2); theM_9 = M_9.insert (M_9.length-1,"Angle"); theM_9 + ="points"; - } in ElseM_9 + ="Whole"; the if(M_9! ="0 Rounding") theM_9 = M_9.replace ("0 Yuan",""); AboutM_9 = M_9.replace ("0 min","Whole"); the if(Type = ="Quantity") the returnM_8; the Else + returnM_9; - } the Catch(Exception ex)Bayi { the returnEx. Message; the } - #endregion -}
C # numbers converted to uppercase