GetBody asp實(shí)現(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漢字中文圖片驗(yàn)證碼的實(shí)現(xiàn)代碼
asp漢字中文圖片驗(yàn)證碼的實(shí)現(xiàn)代碼...2007-11-11在ASP中用組件檢測當(dāng)前網(wǎng)卡地址的代碼
在ASP中用組件檢測當(dāng)前網(wǎng)卡地址的代碼...2007-03-03asp中實(shí)現(xiàn)隨機(jī)分組程序的代碼
asp中實(shí)現(xiàn)隨機(jī)分組程序的代碼...2007-03-03使用ASP控制指定站點(diǎn)解析腳本語言函數(shù)
使用ASP控制指定站點(diǎn)解析腳本語言函數(shù)...2007-01-01用asp實(shí)現(xiàn)訪問遠(yuǎn)程計算機(jī)上MDB access數(shù)據(jù)庫文件的方法
用asp實(shí)現(xiàn)訪問遠(yuǎn)程計算機(jī)上MDB access數(shù)據(jù)庫文件的方法...2007-11-11