public function GetByteCount(data)
dim bcnt , n , nCODE
bcnt = 0
For n = 1 To Len(data)
nCODE = Asc(Mid(data, n, 1))
If nCODE >= 0 And nCODE <= 255 Then
bcnt = bcnt + 1
Else
bcnt = bcnt + 2
End If
Next
GetByteCount = bcnt
End Function
考虑的一般的英数和汉字混合的情况,你说的15个汉字,意思就是取前面30个字节长字符串。
if GetByteCount(strContent) > 30 then
for i= 1 to 30
strTemp = Left(strContent,i)
if GetByteCount(strTemp) >= 30 then
strTemp = strTemp & "....."
exit for
end if
next
end if
<%
If Len(Content)<15 Then
Response.Write(Content)
Else
Response.Write(Left(Content,15)&"...")
End If
'还要判断英文等字符
'http://expert.csdn.net/Expert/TopicView1.asp?id=2870545
%>