/**
* description 將數字金額轉換為中文金額
* @param bigdecimal bigdmoneynumber 轉換前的數字金額
* @return string
呼叫:mytochinesecurrency("101.89")="壹佰零壹圓捌角玖分"
mytochinesecurrency("100.89")="壹佰零捌角玖分"
mytochinesecurrency("100")="壹佰圓整"
*/public string donumbercurrencytochinesecurrency(double bigdmoneynumber) ;
//中文數字字元陣列
string strachinesenumber = new string ;
string strchinesecurrency = "";
//零數字標記
boolean bzero = true;
//中文金額單位下標
int chineseunitindex = 0;
try
//零數字的處理
else
}//萬、億數字的處理
else if (chineseunitindex == 6 || chineseunitindex == 10) }}
//前一數字非零的處理
if (!bzero)
strchinesecurrency = strachinesenumber[0] + strchinesecurrency;
bzero = true;
}doubmoneynumber = math.floor(doubmoneynumber / 10);
chineseunitindex ++;
}//負數的處理
if (bnegative)
strchinesecurrency = "負" + strchinesecurrency;
}catch (exception e)
return strchinesecurrency;}}
JAVA數字大寫金額轉換
public class moneyutil private static final string iunit private static final string dunit public static string tochinese string str else if str.index...
java 數字金額大寫轉換
數字金額大寫轉換,思想先寫個完整的然後將如零拾替換成零 要用到正規表示式 public static string digituppercase double n string digit string unit string head n 0 負 n math.abs n string s for...
將數字轉換為大寫金額
export const changetochinese num num num.replace g,替換tomoney 中的 num num.replace g,替換tomoney 中的空格 num num.replace g,替換掉可能出現的 字元 if isnan num 字元處理完畢後開始轉...