C 數字轉漢字大寫金額

2021-09-19 07:43:20 字數 824 閱讀 5048

private static string nums = "零壹貳叄肆伍陸柒捌玖";

private static string units = "仟佰拾萬仟佰拾億仟佰拾萬仟佰拾元角分釐";

string valuestr = value.tostring("0000000000000000.000");

valuestr = valuestr.remove(valuestr.indexof('.'), 1);

stringbuilder sb = new stringbuilder();

for (int i = 0; i < valuestr.length; i++)

else if (i>0&&valuestr[i-1]!='0')

}return sb.tostring().trim("零".tochararray());

string s = x.tostring("#l#e#d#c#k#e#d#c#j#e#d#c#i#e#d#c#h#e#d#c#g#e#d#c#f#e#d#c#.0b0a");

string d = regex.replace(s, @"((?<=-|^)[^1-9]*)|((?'z'0)[0a-e]*((?=[1-9])|(?'-z'(?=[f-l\.]|$))))|((?'b'[f-l])(?'z'0)[0a-l]*((?=[1-9])|(?'-z'(?=[\.]|$))))", "$$");

return regex.replace(d, ".", m => "負元空零壹貳叄肆伍陸柒捌玖空空空空空空空分角拾佰仟萬億兆京垓秭穰"[m.value[0] - '-'].tostring());

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

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

c 數字金額轉大寫金額

static string moneytoupper string stramount string strlower null string strupart null string strupper null int itemp 0 保留兩位小數 123.489 123.49 123.4 123...

數字金額轉中文大寫金額

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