bod-idv-tw小書製作
2016-03-05
VBScript--中英文混合字元數的計算
在使用ASCII, Big5 ... 等編碼方式的環境下,可以使用以下簡單的函數功能,回傳指定字串的正確字元數。
Function LenC(strTXT)
dim i,n
n=0
for i = 1 to len(strTXT)
if asc(mid(strTXT,i,1)) >=0 and asc(mid(strTXT,i,1)) <= 255 then
n = n + 1
else
n = n + 2
end if
next
LenC = n
End Function
沒有留言:
張貼留言
‹
›
首頁
查看網路版
沒有留言:
張貼留言