因為業務需要,要作乙個金額轉換為大寫的方法,參考了網上眾多資料之後,修改並整理了乙個自認為比較簡潔的c#實現方法,初步測試基本達到了自己的需求,將此方法儲存供自己以後查詢,也請各位多多提供一些合理的建議,作進一步改善!
private static readonly string _numchinese = "零壹貳叄肆伍陸柒捌玖";
private static readonly string _unitchinese = "分角圓拾佰仟萬拾佰仟億拾佰仟萬";
///
/// 將金額轉換為大寫
///
/// 需要轉換的金額
/// 返回的中文大寫字串
public string moneyconverttochineses(double value)
string result = "";
int n= 0;
for (int i=money.length-1; i>=0; i--)
}result = result.replace("零拾", "零");
result = result.replace("零佰", "零");
result = result.replace("零仟", "零");
result = result.replace("零零零", "零");
result = result.replace("零零", "零");
result = result.replace("零角零分", "整");
result = result.replace("零分", "整");
result = result.replace("零角", "零");
result = result.replace("零億零萬零圓", "億圓");
result = result.replace("億零萬零圓", "億圓");
result = result.replace("零億零萬", "億");
result = result.replace("零億", "億");
result = result.replace("零萬", "萬");
result = result.replace("零零", "零");
result = result.substring(0, 2) == "零圓" ? result.replace(result.substring(0, 2), "") : result;
result = result.substring(0, 2) == "零角" ? result.replace(result.substring(0, 2), "") : result;
return result;
}
java 金額轉大寫
classname numberconvert description todo author pangtt date 2012 8 22 上午9 08 10 public class moneyutil 整數部分的單位 private static final string iunit 小數部分的...
金額小寫轉大寫
create procedure dbo trannumbertobigfordecrypt n lowermoney numeric 15,2 v transtype int,ret varchar 200 output with encryption as descript 解密exec sp ...
金額小寫轉大寫
create procedure dbo trannumbertobigfordecrypt n lowermoney numeric 15,2 v transtype int,ret varchar 200 output with encryption as descript 解密exec sp ...