Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

软件开发小程序制作系统集成与运维空间租用硬件开发视频监控技术咨询与支持——联系电话:0311-88999002/88999003

首页 / 网页编程 / ASP / ASP计算str2在str1中出现的次数

function CountStr(str1,str2)
       dim tmp,i,j
       if str1="" or isnull(str1) then
                 j=0
       elseif str2="" or isnull(str2) then
                 j=1
       else
                tmp=split(str1,str2)
                j=0
               for i=0 to ubound(tmp)
                          if tmp(i)<>"" then j=j+1
               next
        end if
        countstr=j
end function