ASP截取字数(一)

function StrLen(Str)
  if Str="" or isnull(Str) then
    StrLen=0
    exit function
  else
    dim regex
    set regex=new regexp
    regEx.Pattern ="[^\x00-\xff]"
    regex.Global =true
    Str=regEx.replace(Str,"^^")
    set regex=nothing
    StrLen=len(Str)
  end if
end function

 

注:[^\x00-\xff]:匹配双字节字符(包括汉字在内)

posted @ 2012-11-05 10:05  Liu66~  阅读(204)  评论(0编辑  收藏  举报