打印本文 打印本文 关闭窗口 关闭窗口
ASP字符串截取函数
作者:武汉SEO闵涛  文章来源:本站原创  点击数2325  更新时间:2011/2/10 22:35:36  文章录入:mintao  责任编辑:mintao
字符串截取函数:

以下是代码片段:
<%
==================================================
'函数名:GetBody
'作  用:截取字符串
'参  数:ConStr ------将要截取的字符串
'参  数:StartStr ------开始字符串
'参  数:OverStr ------结束字符串
'参  数:IncluL ------是否包含StartStr
'参  数: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 Start,Over
   Start = InStrB(1, ConStr, 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,ConStr,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
%>

打印本文 打印本文 关闭窗口 关闭窗口