Public class convertmoney {
Public static void main (string [] ARGs ){
System. Out. println (convert (6800000300.23d ));
}
/**
* Arabic numerals are converted to uppercase Chinese characters. Only up to digits are supported, and decimal conversions are not supported.
* @ Param ARGs
*/
Public static string convert (double N ){
Char [] d = {'0', 'yi', 'er', 'san', 'siz', 'wu', 'l', 'shanghai ', 'handler', 'handler '};
Char [] D2 = {'meta', 'pick', 'taobao', 'taobao', 'wan', 'taobao', 'taobao ', 'yi', 'pick', 'taobao', 'taobao '};
String STR = string. Format ("%. 0f", N );
Stringbuilder sb = new stringbuilder ();
System. Out. println (STR );
If (Str. Length ()> d2.length ){
System. Out. println ("the amount is too large. conversion is not supported! ");
Return NULL;
}
For (INT I = 0; I <Str. Length (); I ++ ){
SB. append (d [Str. charat (I)-'0']);
SB. append (D2 [Str. Length ()-i-1]);
}
STR = sb. tostring ();
STR = Str. replaceall ("Zero [hacker]", "zero ");
STR = Str. replaceall ("Zero {2,}", "zero ");
STR = Str. replaceall ("zero ([trillion yuan])", "$1 ");
STR = Str. replaceall ("hundreds of millions", "hundreds of millions ");
Return STR;
}
}
The above program output:
6800000300
Lu Zhiyi: 0 million yuan