ASP字数计算函数

来源:互联网 发布:web上传文件数据 编辑:程序博客网 时间:2024/04/29 21:56

<%
'ASP字数计算函数
Function WordCount(strInput)
    Dim strTemp
    strTemp = Replace(strInput, vbTab, " ")
    strTemp = Replace(strTemp, vbCr, " ")
    strTemp = Replace(strTemp, vbLf, " ")

    ' 删除字首字尾空格
    strTemp = Trim(strTemp)

    ' 替换为一个空格
    Do While InStr(1, strTemp, "  ", 1) <> 0
        strTemp = Replace(strTemp, "  ", " ")
    Loop
WordCount = UBound(Split(strTemp, " ", -1, 1)) +1
End Function
%>

原创粉丝点击