GetBody asp实现截取字符串的代码
2018-09-06 12:28
  ================================================== 
函数名:GetBody 
作用:截取字符串 
参数:ConStr------将要截取的字符串 
参数:StartStr------开始字符串 
参数:OverStr------结束字符串 
参数:IncluL------是否包含StartStr 
参数:IncluR------是否包含OverStr 
================================================== 
FunctionGetBody(ConStr,StartStr,OverStr,IncluL,IncluR) 
IfConStr=$False$orConStr=orIsNull(ConStr)=TrueOrStartStr=orIsNull(StartStr)=TrueOrOverStr=orIsNull(OverStr)=TrueThen 
GetBody=$False$ 
ExitFunction 
EndIf 
DimConStrTemp 
DimStart,Over 
ConStrTemp=Lcase(ConStr) 
StartStr=Lcase(StartStr) 
OverStr=Lcase(OverStr) 
Start=InStrB(1,ConStrTemp,StartStr,vbBinaryCompare) 
IfStart<=0then 
GetBody=$False$ 
ExitFunction 
Else 
IfIncluL=FalseThen 
Start=Start+LenB(StartStr) 
EndIf 
EndIf 
Over=InStrB(Start,ConStrTemp,OverStr,vbBinaryCompare) 
IfOver<=0OrOver<=Startthen 
GetBody=$False$ 
ExitFunction 
Else 
IfIncluR=TrueThen 
Over=Over+LenB(OverStr) 
EndIf 
EndIf 
GetBody=MidB(ConStr,Start,Over-Start) 
EndFunction