常用ASP函数集【经验才是最重要的】(12)


        ElseIf iDay > 20 Then
            Date2Chinese = Date2Chinese + num(iDay \ 10) + "十" +num(iDay Mod 10) + "日"
        Else
           Date2Chinese = Date2Chinese + "十" + num(iDay Mod 10) + "日"
        End If
    Else
        Date2Chinese = Date2Chinese + num(iDay Mod 10) + "日"
    End If
End Function


Function lenStr(str)'计算字符串长度(字节)
    dim l,t,c
    dim i
    l=len(str)
    t=0
for i=1 to l
    c=asc(mid(str,i,1))
    if c<0 then c=c+65536
    if c<255 then t=t+1
    if c>255 then t=t+2
next
   lenstr=t
End Function

Function CreateArr(str) '生成二维数组 数据如:"1,a1,b1,c1,d1|2,a2,b2,c2,d2|5,a3,b3,c3,d3|8,a4,b4,c4,d4"
dim arr()
str=split(str,"|")
for i=0 to UBound(str)
    arrstr=split(str(i),",")
    for j=0 to Ubound(arrstr)
        ReDim Preserve arr(UBound(str),UBound(arrstr))
        arr(i,j)=arrstr(j)
    next
next
CreateArr=arr
End Function

Function ShowRsArr(rsArr) '用表格显示记录集getrows生成的数组的表结构
showHtml="<table width=100% border=1 cellspacing=0 cellpadding=0>"
    If Not IsEmpty(rsArr) Then
        For y=0 To Ubound(rsArr,2)
        showHtml=showHtml&"<tr>"
            for x=0 to Ubound(rsArr,1)
                showHtml=showHtml& "<td>"&rsArr(x,y)&"</td>"
            next
        showHtml=showHtml&"</tr>"
        next
    Else
        RshowHtml=showHtml&"<tr>"
        showHtml=showHtml&"<td>No Records</td>"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3170.html