ASP字数计算函数

 1   
 2'ASP字数计算函数   
 3Function WordCount(strInput)   
 4Dim strTemp   
 5strTemp = Replace(strInput, vbTab, " ")   
 6strTemp = Replace(strTemp, vbCr, " ")   
 7strTemp = Replace(strTemp, vbLf, " ") 
 8
 9' 删除字首字尾空格   
10strTemp = Trim(strTemp) 
11
12' 替换为一个空格   
13Do While InStr(1, strTemp, " ", 1) <> 0   
14strTemp = Replace(strTemp, " ", " ")   
15Loop   
16WordCount = UBound(Split(strTemp, " ", -1, 1)) +1   
17End Function   
Published At
Categories with Web编程
Tagged with
comments powered by Disqus