public
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 dblmoney double 數字 param blnfull boolean false,2001.30 貳仟零壹元叄角整 true,2001.30 貳仟零佰零拾壹元叄角零分 param bzheng boolean 是否強制末尾加整字 如果...
C 大小寫轉換
time limit 1000 ms memory limit 65536 kib submit statistic problem description x現在要學習英文以及各種稀奇古怪的字元的了。現在他想把一串字元中的小寫字母變成大寫字元,大寫字母變成小寫字母,其他的保持不變。input 輸入...
C 大小寫轉換
如果使用string類,可以使用 include裡的如下方法進行大小寫轉換 leetcode不支援這個函式 transform str.begin str.end str.begin tolower 記得 tolower前面有 而且是 tolower,不是 tolower 如果用char陣列,也可以...