萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> asp編程 >> ASP字數計算函數

ASP字數計算函數

 <%

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

 
copyright © 萬盛學電腦網 all rights reserved