' This article provides the ASP string intercept function is the first to use the definition of string discriminant function to determine the length of the string and the Chinese and English, and then the characters after the interception of the definition beyond the content of ... Display mode
function strvalue (str,lennum)
Dim p_num
Dim i
If strlen (str) <=lennum Then
Strvalue=str
Else
P_num=0
X=0
Do, not p_num > Lennum-2
X=x+1
If ASC (Mid (str,x,1)) <0 Then
P_num=int (P_num) + 2
Else
P_num=int (p_num) + 1
End If
Strvalue=left (Trim (str), x) & "..." ' After interception, define the display mode beyond the content
Loop
End If
End Function
' Define string discriminant function www.111cn.net
function strlen (str)
Dim P_len
P_len=0
Strlen=0
If Trim (str) <> "" Then
P_len=len (Trim (str))
For Xx=1 to P_len
If ASC (Mid (str,xx,1)) <0 Then
Strlen=int (strlen) + 2
Else
Strlen=int (strlen) + 1
End If
Next
End If
End Function
' Intercept string, 1. Includes front and back strings, 2. Do not include before and after strings
function strcut (strcontent,startstr,endstr,cuttype)
Dim s1,s2
On Error Resume Next
Select Case Cuttype
Case 1
S1 = InStr (strcontent,startstr)
s2 = InStr (S1,strcont ENT,ENDSTR) +len (ENDSTR)
Case 2
S1 = InStr (STRCONTENT,STARTSTR) +len (startstr)
s2 = InStr (S1, STRCONTENT,ENDSTR)
End Select
If Err then
Strcute = "<p align= ' center ' ><font size=-1> Intercept string Error .</font></p> '
err.clear
Exit Function
Else
Strcut = Mid (strcontent,s1 , S2-S1)
End If
End Function