To write an ASP code intercept string:
' Function name: SUBSTZFC
' function: truncated string, Chinese character one count two characters, English count a character
' Argument: str----Original string
' strlen----intercept length
' Return value: After the intercepted string
' Applicable: The title intercepts the specified characters, if left to intercept, when there is English will appear to take out the title is obviously too short.
'**************************************************
Public Function SUBSTZFC (ByVal str, ByVal strlen)
If str = "" Then
SUBSTZFC = ""
Exit Function
End If
Dim L, T, C, I, strtemp
str = replace (replace (replace (str, "", ""), "", Chr (), ">", ">"), "<", "<")
L = Len (str)
t = 0
strtemp = str
strlen = CLng (strlen)
For i = 1 to L
c = Abs (ASC (Mid (str, I, 1))
If C > 255 Then
t = t + 2
Else
t = t + 1
End If
If T >= strlen Then
strtemp = left (str, i)
Exit for
End If
Next
SUBSTZFC = replace (replace (replace (strtemp, "", "), CHR (+)," ""), ">", ">"), "<", "<")
End Function