using System;
using System.Collections;
using System.Text;
public class MyClass
{
public static void Main()
{
Console.WriteLine(FormatRMB(101010101010.23));
}
public static string FormatRMB( double intRmb )
{
const string UNIT = "分角元十百千萬十百千仡十百千萬";
const string UPPER = "零壹貳毿肆伍陸柒捌玖";
string strRmb = Math.Round(intRmb*100).ToString();
if( strRmb.Length > UNIT.Length ) return "";
StringBuilder result = new StringBuilder(strRmb.Length*2+1);
bool isZero = false ;
for( int i = 0 ,j = strRmb.Length-1 ; i <= j ; i ++ )
{
if ( strRmb[i] > 48 )
{
if( isZero )
result.Append(UPPER[0]);
result.Append(UPPER[strRmb[i]-48]);
result.Append(UNIT[j-i]);
isZero = false ;
}
else
{
isZero = true ;
if( UNIT[j-i] == '元' || UNIT[j-i] == '萬' || UNIT[j-i] == '仡' )
{
result.Append(UNIT[j-i]);
isZero = false ;
}
}
}
if( result[result.Length -1] == '元')
result.Append('整');
return result.ToString().Replace("壹十","十");
}
}