28,408
社区成员




dim str
str = "中文是2个字符"
response.write leng(str) ' 要求返回13
function leng(s)
' 这里怎么写?lenb这个为什么当参数为1个字节的字符时显示的是2呢?
end function
dim str
str = "中文是2个字符"
response.write leng(str)
Function leng(s)
Dim c, n, i, a
n = 0
For i= 1 To Len(s)
c = Mid(s,i,1)
a = Asc(c)
If a>=0 And a<=255 Then
n = n + 1
Else
n = n + 2
End If
Next
leng = n
end Function