Chinese character _ practical skills based on asp.net implementation date to uppercase

Source: Internet
Author: User

This article mainly introduces the use of ASP.net date format to capitalize Chinese characters, such as: "December 3, 2013" converted to "two 0 three years to pick up two days," the following to see how to achieve.

The same words not much said, directly on the code

Year converted to uppercase Kanji public
  static string numtoupper (int num)
   {return
    "0 Woolu qi ba nine" [Num]. ToString ();
   }

Month Conversion Capital Kanji public
  static string monthtoupper (int month)
  {
   if (month < a)
   {return
    numtoupper ( month);
   }
   else
   {
    if (month = =) {return "a";}

    else
    {return
     "one pick" + numtoupper (month-10);
    }


}} The date is converted to uppercase Kanji public
  static string daytoupper (int day)
  {
   if (Day <)
   {return
    monthtoupper (day);
   }
   else
   {
    String str = day. ToString ();
    if (str[1] = = ' 0 ')
    {return
     numtoupper convert.toint16 (str[0). ToString ()) + "Pick up";
    }
    else
    {return
     numtoupper convert.toint16 (str[0). ToString ()) + "Pick up"
      + numtoupper (convert.toint16 (str[1). ToString ());}
    }
  
static void Main (string[] args)
  {
   string year = "2013";
   string retur = String. Empty;
   for (int i = 0; i < year. Length; i++)
   {
    retur + = numtoupper (int. Parse (Year[i]. ToString ())). ToString ();
   }
   Console.WriteLine (Retur + "year");
   Retur = string. Empty;
   String month = "a";
   Retur = Monthtoupper (Convert.ToInt32 (month));
   Console.WriteLine (retur + "month");
   String day = "3";
   Retur = Daytoupper (Convert.ToInt32 (day));
   Console.WriteLine (retur + "Day");
   Console.ReadLine ();
  }

The above is the use of asp.net date format into the full text of the Chinese characters, I hope this article on the content of the use of ASP.net can help.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.