/// //
/ 將數字轉為大寫
///
/// //
/ public string moneytochinese(string lowermoney)
string strlower = null
; string strupart = null
; string strupper = null
;
int itemp = 0;
//保留兩位小數 123.489→123.49 123.4→123.4
lowermoney = math.round(double.parse(lowermoney), 2).tostring();
if (lowermoney.indexof(".") > 0)
}else
strlower =lowermoney;
itemp = 1;
strupper = "";
while (itemp <=strlower.length)
switch
(itemp)
strupper = strupart +strupper;
itemp = itemp + 1;
}strupper = strupper.replace("零拾", "零");
strupper = strupper.replace("零佰", "零");
strupper = strupper.replace("零仟", "零");
strupper = strupper.replace("零零零", "零");
strupper = strupper.replace("零零", "零");
strupper = strupper.replace("零角零分", "整");
strupper = strupper.replace("零分", "整");
strupper = strupper.replace("零角", "零");
strupper = strupper.replace("零億零萬零圓", "億圓");
strupper = strupper.replace("億零萬零圓", "億圓");
strupper = strupper.replace("零億零萬", "億");
strupper = strupper.replace("零萬零圓", "萬圓");
strupper = strupper.replace("零億", "億");
strupper = strupper.replace("零萬", "萬");
strupper = strupper.replace("零圓", "圓");
strupper = strupper.replace("零零", "零");
//對壹圓以下的金額的處理
if (strupper.substring(0, 1) == "圓")
if (strupper.substring(0, 1) == "零")
if (strupper.substring(0, 1) == "角")
if (strupper.substring(0, 1) == "分")
if (strupper.substring(0, 1) == "整")
functionreturnvalue =strupper;
if (isnegative == true
)
else
}
金額數字轉中文大寫
public class moneyutil 整數部分的單位 private static final string iunit 小數部分的單位 private static final string dunit 得到大寫金額。public static string tochinese strin...
Util 金額數字轉中文大寫
package com.inforstack.common author cluo 金額數字轉中文大寫 public class moneyutil 整數部分的單位 private static final string iunit 小數部分的單位 private static final stri...
Util 金額數字轉中文大寫
package com.inforstack.common author cluo 金額數字轉中文大寫 public class moneyutil 整數部分的單位 private static final string iunit 小數部分的單位 private static final stri...