欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ASP计算str2在str1中出现的次数

程序员文章站 2022-08-06 09:57:28
function countstr(str1,str2)        dim t...
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