用ASP將小寫金額轉成大寫(函式)

2021-04-06 15:15:57 字數 1313 閱讀 5065

asp**:

<%

function rmb(num)

num = formatnumber(num, 2)

dim numlist

dim rmblist

dim numlen

dim numchar

dim numstr

dim n

dim n1, n2

dim hz

numlist = "零壹貳叄肆伍陸柒捌玖"

rmblist = "分角元拾佰仟萬拾佰仟億拾佰仟萬"

if num > 9999999999999.99 then

rmb = "超出範圍的人民幣值"

exit function

end if

numstr = cstr(num * 100)

numlen = len(numstr)

n = 1

do while n <= numlen

numchar = cint(mid(numstr, n, 1))

n1 = mid(numlist, numchar + 1, 1)

n2 = mid(rmblist, numlen - n + 1, 1)

if not n1 = "零" then

hz = hz + cstr(n1) + cstr(n2)

else

if n2 = "億" or n2 = "萬" or n2 = "元" or n1 = "零" then

do while right(hz, 1) = "零"

hz = left(hz, len(hz) - 1)

loop

end if

if (n2 = "億" or (n2 = "萬" and right(hz, 1) <> "億") or n2 = "元") then

hz = hz + cstr(n2)

else

if left(right(hz, 2), 1) = "零" or right(hz, 1) <> "億" then

hz = hz + n1

end if

end if

end if

n = n + 1

loop

do while right(hz, 1) = "零"

hz = left(hz, len(hz) - 1)

loop

if right(hz, 1) = "元" then

hz = hz + "整"

end if

rmb = hz

end function

%>

asp小留言本

第一部分 建立資料庫 create database lyb gouse lyb gocreate table liuyan liuyanid int identity not null,username varchar 50 datetime datetime,content varchar 50...

用asp生成PDF檔案

首先必須在定義欄位的工作站 不是伺服器 上安裝有adobe完全版。這個是一個指向adobe forms acrobat toolkit的連結,由此開始一切就容易了。http partners.adobe.asn developer acrosdk forms.html 並把它解壓縮到指定目錄。當你進...

ASP用stream讀檔案

前幾天要寫一個東西里面有用到讀檔案的。可是我不想用fso,我怕有的空間不支援。可是網路上找了半天沒有找到一個不是用fso寫的。還是自己做了一個。我記得以前在做無元件上傳,並儲存檔案的時候有用到stream 我發現有一個loadfromfile的方法。可以讀取檔案。下面是我的 function rea...

用asp生成PDF檔案

adobe pdf格式已經變成很多機構和公司進行跨平臺製表的通用 格式。儘管我不是這個產品的狂熱痴迷者,卻不得不接受這樣一個事實 用這個格式產生一個協定可能會比用word還要好。我試了各種辦法,但是看來都有一個很大的限制 如果我能快速產生它,它就只能是一個html形式的衍生物,在列印時就會變得面目全...

用ASP設計購物推車

什麼是購物推車?你一定去過超級市場吧。在那裡你可以推著推車,將中意的商品放進推車,或者把推車裡的商品取出來重新放到貨架,最後你推著推車去結賬。那麼,在網上超市,客戶也應該可以在瀏覽商品目錄時,將中意的商品放進 電子推車 電子推車是超級市場推車的電子化。在網上商店裡,這種電子推車又稱為 購物推車 英文...