// Chinese amount unit array
StrachineseUnit = new string [] {"分", "angle", "round", "pick", "", "仟", "10,000", "", "", "100 million" , "Pick", "", ""}
// Chinese numeric character array
StrachineseNumber = new string [] {"Zero", "", "", "", "", "Wu", "柒", "捌", "玖"}
/ **
* Description converts the number amount to the Chinese amount
* @Param
BigDecimal BigdmoneyNumber Digital amount before converting P>
* @Return String
Call: MyToChineseCurrency ("101.89") = "零 零 圆 捌 捌"
MyToChineseCurrency ("100.89") = "佰 零 捌"
MyToCHINESECURRENCY ("100") = "佰 round"
* /
Public String DonumbercurrencyToChineseCurrency (BigDecimal BigdmoneyNumber) {
String strChinesecurrency = "";
// Zero bit mark
Boolean Bzero = True;
// Chinese money unit subscript
INT chineseunitIndex = 0;
DOPRINTMESSAGE ("Calling Method DonumbercurrencyTochineseCurrency);
Try {
IF (BigdMoneyNumber.intValue () == 0)
Return "zero round whole";
// Process the fractional part, round
Double DoubmoneyNumber = Math.Round (BigdmoneyNumber.doubleValue () * 100);
// is negative
Boolean Bnegative = DoubmoneyNumber <0;
// Take absolute value
DoubmoneyNumber = Math.Abs (DoubmoneyNumber);
// loop processing conversion operation
While (DoubmoneyNumber> 0) {
// Treatment (no small number)
IF (ChineseUnitIndex == 2 && strchinesecurrency.length () == 0)
StrChinesecurrency = strchinesecurrency "whole";
// non-zero bit processing
IF (DouBmoneyNumber% 10> 0) {
StrChinesecurrency = strachinesecur [(int) DoubmoneyNumber% 10] strachineseunit [chineseUnitIndex] strchinesecurrency;
Bzero = FALSE;
}
// Zero bit processing
ELSE {// yuan processing (bit)
IF (ChineseUnitIndex == 2) {
There are numbers in segments
IF (DoubmoneyNumber> 0) {
StrChinesecurrency = strachineseunit [chineseunitIndex] strchinesecurrency;
Bzero = True;
}
}
/// 10 million processing
Else IF (ChineseUnitIndex == 6 || ChineseUnitIndex == 10) {
There are numbers in segments
IF (DoubmoneyNumber% 1000> 0)
StrChinesecurrency = strachineseunit [chineseunitIndex] strchinesecurrency;
}
// A few non-zero processing
IF (! bzero)
StrChinesecurrency = strachinesenumber [0] strchinesecurrency;
Bzero = True;
}
DoubmoneyNumber = Math.Floor (DoubmoneyNumber / 10);
ChineseUnitIndex ;
}
/ / Negative processing
IF (Bnegative)
StrChinesecurrency = "Negative" StrChineseCurrency;
}
Catch (Exception E) {
DOPRINTMESSAGE ("Exception Reason: Call Method DonumbercurrencyTochineseCurrency Error");
DOPRINTMESSAGE ("Exception Message:" E.GetMessage ());
E.PrintStackTrace ();
""; "
}
Return strChinesecurrency;
}