Convert the amount to uppercase RMB
Last Update:2018-12-06
Source: Internet
Author: User
/// <Summary>
/// Convert to uppercase RMB
/// </Summary>
/// <Param name = "X"> </param>
/// <Returns> </returns>
Public static string tormb (string X)
{
String ret = "";
Int nnum;
X = x. Replace ("-","");
If (X. indexof (".")>-1)
{
If (X. Length = (X. indexof (".") + 2) x = x + "0 ";
Nnum = int. parse (X. substring (0, x. indexof (".")));
If (X. substring (X. indexof (".") + 1, 2) = "00 ")
Ret = toint (nnum. tostring () + "meta ";
Else ret = toint (nnum. tostring () + "meta" + todot (X. substring (X. indexof (".") + 1, 2 ));
}
Else
{
Ret = toint (x) + "Yuan ";
}
Return ret;
}
Private Static char tonum (char X)
{
String strchnnames = "";
String strnumnames = "0123456789 ";
Return strchnnames [strnumnames. indexof (x)];
}
Private Static string changeint (string X)
{
String [] strarraylevelnames = new string [4] {"", "Pick", "unlock", "unlock "};
String ret = "";
Int I;
For (I = x. Length-1; I> = 0; I --)
If (X [I] = '0 ')
Ret = tonum (X [I]) + ret;
Else
Ret = tonum (X [I]) + strarraylevelnames [X. Length-1-I] + ret;
While (I = ret. indexof ("0 "))! =-1)
Ret = ret. Remove (I, 1 );
If (Ret [ret. Length-1] = '0' & ret. length> 1)
Ret = ret. Remove (Ret. Length-1, 1 );
If (Ret. length> = 2 & ret. substring (0, 2) = "")
Ret = ret. Remove (0, 1 );
Return ret;
}
Private Static string toint (string X)
{
Int Len = x. length;
String ret, temp;
If (LEN <= 4)
Ret = changeint (X );
Else if (LEN <= 8)
{
Ret = changeint (X. substring (0, len-4) + "Ten Thousand ";
Temp = changeint (X. substring (LEN-4, 4 ));
If (temp. indexof ("temperature") =-1 & temp! = "")
RET + = "zero" + temp;
Else
RET + = temp;
}
Else
{
Ret = changeint (X. substring (0, len-8) + "";
Temp = changeint (X. substring (LEN-8, 4 ));
If (temp. indexof ("temperature") =-1 & temp! = "")
RET + = "zero" + temp;
Else
RET + = temp;
RET + = "Ten Thousand ";
Temp = changeint (X. substring (LEN-4, 4 ));
If (temp. indexof ("temperature") =-1 & temp! = "")
RET + = "zero" + temp;
Else
RET + = temp;
}
Int I;
If (I = ret. indexof ("0 thousand "))! =-1)
Ret = ret. Remove (I + 1, 1 );
While (I = ret. indexof ("0 "))! =-1)
Ret = ret. Remove (I, 1 );
If (Ret [ret. Length-1] = '0' & ret. length> 1)
Ret = ret. Remove (Ret. Length-1, 1 );
Return ret;
}
Private Static string todot (string X)
{
String ret = "";
String sdot = "Angular score ";
If (X. length> 2) x = x. substring (0, 2 );
For (INT I = 0; I <X. length; I ++)
{
RET + = tonum (X [I]) + sdot. substring (I, 1 );
}
If (Ret. indexof ("")>-1) ret = ret. substring (2, 2 );
If (Ret. indexof ("0")>-1) ret = ret. substring (0, 2 );
Return ret;
}