//usage Mode Numtoupper ("2014") + "year" + Monthtoupper ("12") + "month" + daytoupper ("12") + "Day" Public Static stringNumtoupper (intnum) {String str=Num. ToString (); stringRSTR =""; intN; for(inti =0; I < Str. Length; i++) {n= Convert.ToInt16 (Str[i]. ToString ());//Char to a number, converted to a string, then to a number Switch(n) { Case 0: RSTR = rstr +"0"; Break; Case 1: RSTR = rstr +"a"; Break; Case 2: RSTR = rstr +"two"; Break; Case 3: RSTR = rstr +"three"; Break; Case 4: RSTR = rstr +"Four"; Break; Case 5: RSTR = rstr +"Five"; Break; Case 6: RSTR = rstr +"Six"; Break; Case 7: RSTR = rstr +"Seven"; Break; Case 8: RSTR = rstr +"Eight"; Break; default: RSTR = rstr +"Nine"; Break; } } returnRstr; } //convert Month to uppercase Public Static stringMonthtoupper (intmonth) { if(Month <Ten) { returnNumtoupper (month); } Else if(Month = =Ten) {return "10"; } Else { return "10"+ numtoupper (Month-Ten); } } //convert Day to uppercase Public Static stringDaytoupper (intDay ) { if(Day < -) { returnMonthtoupper (day); } Else{String str=Day . ToString (); if(str[1] =='0') { returnNumtoupper (Convert.ToInt16 (str[0]. ToString ())) +"10"; } Else { returnNumtoupper (Convert.ToInt16 (str[0]. ToString ())) +"10"+ Numtoupper (convert.toint16 (str[1]. ToString ())); } } } //convert date to uppercase Private stringdatetoupper (system.datetime date) {//by Len Lei email:[email protected],[email protected] 2007.10.25 intYear =date. year; intmonth =date. Month; intDay =date. Day; returnNumtoupper (year) +"years"+ monthtoupper (Month) +"Month"+ Daytoupper (Day) +"Day"; }
Convert dates to uppercase and lowercase