c 數字金額轉大寫金額

2022-04-04 02:17:16 字數 1788 閱讀 1309

static string moneytoupper(string stramount)             string strlower = null;         string strupart = null;         string strupper = null;         int itemp = 0;         // 保留兩位小數 123.489→123.49  123.4→123.4         stramount = math.round(double.parse(stramount), 2).tostring();         if (stramount.indexof(".") > 0)                 }         else                 strlower = stramount;         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        

數字金額轉中文大寫金額

用來將數字金額轉化成中文大寫的金額 param value return public static string changetobig double value 段內位置表示 char vunit 段名表示 char digit 數字表示 decimalformat df new decimal...

php 數字金額轉漢字大寫金額

數字金額轉漢字金額 測試 public function testnum 數字金額轉漢字金額 param float money 數字金額 param int type 已棄用 return string 漢字金額 public function numtormb money type 0 mone...

C 數字轉漢字大寫金額

private static string nums 零壹貳叄肆伍陸柒捌玖 private static string units 仟佰拾萬仟佰拾億仟佰拾萬仟佰拾元角分釐 string valuestr value.tostring 0000000000000000.000 valuestr val...