·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> ASP字数计算函数

ASP字数计算函数

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23

<%
'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
%>