【阿拉伯数字转换人民币大写】将阿拉伯数字日期转换为中文数字日期格式(ASP)

时间:2014-08-29  来源:中文酷站  阅读:
刚才看到一个兄弟提的问题,做完了才发现已经结贴,郁闷呀~~
只是看到这个东西还算有用,所以贴出来自赏呵呵
思路:
一开始想到用select,用for循环将每位阿拉伯数字转换成对应的中文,然后想到其实可以用数组,这样子比较少些代码,毕竟0~9,可以对应起来,可是~问题出现了,对于10~31,要变成“贰拾壹” 这样格式,呵呵~加一个判断,嗯~11可不能转换成“壹拾壹”,在加判断
呵呵~基本好了,还需要判断是不是数字呢,ok!这下子应该是可以over了!
<%
t=Now()
Function datetostr(t)
Dim strYear,strMonth,strDay,strResult
strYear = Year(t)
strMonth = Month(t)
strDay = Day(t)
datetostr = casei(strYear) & "年" & casei(strMonth) & "月" & casei(strDay) & "日"
End Function
Function casei(i)
Dim arrNum,arrCNNum
If(IsNumeric(i))Then
arrNum = Split(i)
arrCNNum=Split("零,壹,贰,叁,肆,伍,陆,柒,捌,玖",",")
If( i<10 OR i>31)Then
For it=1 To Len(i)
strResult = strResult & arrCNNum(CInt(Mid(i,it,1)))
Next
ElseIf(i > 9 AND i < 12)Then
strResult = "拾" & arrCNNum(CInt(Mid(i,2,1)))
Else
strResult = arrCNNum(CInt(Mid(i,1,1))) & "拾" & arrCNNum(CInt(Mid(i,2,1)))
End If
End If
casei = strResult
End Function
Response.Write(datetostr(t))
%>

【阿拉伯数字转换人民币大写】将阿拉伯数字日期转换为中文数字日期格式(ASP)

http://m.bbyears.com/kuzhan/8892.html

推荐访问:阿拉伯数字转换大写
相关阅读 猜你喜欢
本类排行 本类最新