Regular Expressions can also be used to convert the amount of Arabic numerals into Chinese uppercase numbers.

Source: Internet
Author: User

Using system;
Using system. Text. regularexpressions;

Class Program
{
// Convert the amount of Arabic numerals into Chinese uppercase numbers
Static string converttochinese (Double X)
{
String S = x. tostring ("# L # e # D # C # K # e # D # C # J # e # D # C # I # e # D # C # h # e # d # C # G # e # D # C # F # e # D # C #. 0b0a ");
String d = RegEx. Replace (S ,@"((? <=-| ^) [^ 1-9] *) | ((? 'Z' 0) [0a-e] * (? = [1-9]) | (? '-Z '(? = [F-L/.] | $) | ((? 'B' [F-L]) (? 'Z' 0) [0a-l] * (? = [1-9]) | (? '-Z '(? = [/.] | $) "," $ {B }$ {z }");
Return RegEx. replace (d ,". ", delegate (Match m) {return" negative element null 0 0 0 0 0 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3. value [0]-']. tostring ();});
}

Static void main ()
{
Random r = new random ();
For (INT I = 0; I <10; I ++)
{
Double X = R. Next ()/100.0;
Console. writeline ("{0, 14: N2 }:{ 1}", X, converttochinese (x ));
}
}
}
/* Possible output:
5,607,400.68
2,017,723.33
751,181.17
7,849,851.53: zookeeper
2,629,143.90
13,461,629.68
4,594,391.16
13,046,560.60
13,041,371.21
20,639,609.44
*/

 

Http://topic.csdn.net/u/20101126/14/636c5e88-2297-4ce6-bf40-e6427c2799a4.html

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.