GetBody asp實現(xiàn)截取字符串的代碼
更新時間:2007年09月01日 22:05:41 作者:
'==================================================
'函數(shù)名:GetBody
'作 用:截取字符串
'參 數(shù):ConStr ------將要截取的字符串
'參 數(shù):StartStr ------開始字符串
'參 數(shù):OverStr ------結(jié)束字符串
'參 數(shù):IncluL ------是否包含StartStr
'參 數(shù):IncluR ------是否包含OverStr
'==================================================
Function GetBody(ConStr,StartStr,OverStr,IncluL,IncluR)
If ConStr="$False$" or ConStr="" or IsNull(ConStr)=True Or StartStr="" or IsNull(StartStr)=True Or OverStr="" or IsNull(OverStr)=True Then
GetBody="$False$"
Exit Function
End If
Dim ConStrTemp
Dim Start,Over
ConStrTemp=Lcase(ConStr)
StartStr=Lcase(StartStr)
OverStr=Lcase(OverStr)
Start = InStrB(1, ConStrTemp, StartStr, vbBinaryCompare)
If Start<=0 then
GetBody="$False$"
Exit Function
Else
If IncluL=False Then
Start=Start+LenB(StartStr)
End If
End If
Over=InStrB(Start,ConStrTemp,OverStr,vbBinaryCompare)
If Over<=0 Or Over<=Start then
GetBody="$False$"
Exit Function
Else
If IncluR=True Then
Over=Over+LenB(OverStr)
End If
End If
GetBody=MidB(ConStr,Start,Over-Start)
End Function
'函數(shù)名:GetBody
'作 用:截取字符串
'參 數(shù):ConStr ------將要截取的字符串
'參 數(shù):StartStr ------開始字符串
'參 數(shù):OverStr ------結(jié)束字符串
'參 數(shù):IncluL ------是否包含StartStr
'參 數(shù):IncluR ------是否包含OverStr
'==================================================
Function GetBody(ConStr,StartStr,OverStr,IncluL,IncluR)
If ConStr="$False$" or ConStr="" or IsNull(ConStr)=True Or StartStr="" or IsNull(StartStr)=True Or OverStr="" or IsNull(OverStr)=True Then
GetBody="$False$"
Exit Function
End If
Dim ConStrTemp
Dim Start,Over
ConStrTemp=Lcase(ConStr)
StartStr=Lcase(StartStr)
OverStr=Lcase(OverStr)
Start = InStrB(1, ConStrTemp, StartStr, vbBinaryCompare)
If Start<=0 then
GetBody="$False$"
Exit Function
Else
If IncluL=False Then
Start=Start+LenB(StartStr)
End If
End If
Over=InStrB(Start,ConStrTemp,OverStr,vbBinaryCompare)
If Over<=0 Or Over<=Start then
GetBody="$False$"
Exit Function
Else
If IncluR=True Then
Over=Over+LenB(OverStr)
End If
End If
GetBody=MidB(ConStr,Start,Over-Start)
End Function
相關(guān)文章
在ASP中用組件檢測當(dāng)前網(wǎng)卡地址的代碼
在ASP中用組件檢測當(dāng)前網(wǎng)卡地址的代碼...2007-03-03用asp實現(xiàn)訪問遠程計算機上MDB access數(shù)據(jù)庫文件的方法
用asp實現(xiàn)訪問遠程計算機上MDB access數(shù)據(jù)庫文件的方法...2007-11-11