/*---------------------------------
--功能描述:獲取乙個金額的大寫格式
--引數及返回值說明:dsum:decimal型別
-- returnvaleu:string型別
---------------------------------*/
boolean digit = false
int i,n,length
string temp,temp1,temp2,upper1,upper2,upper = ""
upper1 = '零壹貳叄肆伍陸柒捌玖'
upper2 = '元拾佰仟萬拾佰仟億'
temp = string(dsum,"###.##")
length = len(temp)
if pos(temp,".")>0 then
temp1 = left(temp,pos(temp,".") - 1)
temp2 = right(temp,length - pos(temp,"."))
if integer(temp2) = 0 then temp2=""
else
temp1 = temp
temp2 =""
end if
length = len(temp1)
temp = ""
for i = 1 to length
n = integer(mid(temp1, i, 1))
if n=0 then //digit: true 表示上一數字為0
digit = true
continue
end if
if digit then temp = "零" + mid(upper1, n * 2 + 1, 2) else temp = mid(upper1, n * 2 + 1, 2)
digit = false
upper = upper + temp + mid(upper2, (length - i) * 2 + 1, 2)
next
if digit then upper = upper + "元"
temp=""
length = len(temp2)
choose case length
case 2
n=integer(right(temp2,1))
if n>0 then temp= mid(upper1,n*2+1,2) +"分"
i=integer(left(temp2,1))
if i>0 then upper = upper + mid(upper1,i*2+1,2) +"角" else upper = upper + mid(upper1,i*2+1,2)
upper = upper + temp
case 1
i=integer(left(temp2,1))
if i>0 then upper = upper + mid(upper1,i*2+1,2) +"角"
end choose
return upper + "整"
數字金額轉化為大寫金額
create or replace function fn getmoneytochina p money in number return varchar2 is 功能 數字金額轉化為漢字金額 最大支援金額 9999999999999999.99 支援千萬億的任何金額 小數點支援2位 type m...
數字金額轉化為中文大寫
數字金額轉換成中文大寫金額的函式 string int num 要轉換的小寫數字或小寫字串 return 大寫字母 小數字為兩位 function num to rmb num i 0 c while 1 else 每次將最後一位數字轉化為中文 p1 substr c1,3 n,3 p2 subst...
數字金額轉化大寫金額
數字金額轉化大寫金額 param val string number 字串可包含 和多餘的0 returns 原生方法 如下所示 function convertcurrency money if typeof money string if money maxnum if money 0 轉換為字...