• 企业400电话
  • 网络优化推广
  • AI电话机器人
  • 呼叫中心
  • 全 部 栏 目

    网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    截取实际长度字符串,并用空格替换
    POST TIME:2021-10-18 07:23

    function cutstr(thestr,strlen)
    dim l,t,c
    l=len(thestr)
    t=0
    for dxy=1 to l
    c=Abs(asc(Mid(thestr,dxy,1)))
    if c>255 then
    t=t+2
    else
    t=t+1
    end if
    if t>=strlen then
    thev=left(thestr,dxy)
    exit for
    else
    bu=strlen-t
    for bui=1 to bu
    strbu="nbsp;"
    strbuall=strbuallstrbu
    next
    thev=thestrstrbuall
    strbu=""
    strbuall=""
    end if
    next
    cutstr=thev
    end function

    %
    '============================
    '函数名w_cut(type,num)
    '作用:字符串截取
    '参数type,num
    'type:字符串内容
    'num:字符串被截取的长度
    '=============================

    Function w_cut(types,num)
      dim ctypes,cnum,ci,tt,tc,cc
      ctypes=types:cnum=int(num):w_cut="":tc=0:cc=0
      for ci=1 to len(ctypes)
        if cnum0 then w_cut=w_cut"...":exit for
        tt=mid(ctypes,ci,1)
        if int(asc(tt))>=0 then
          w_cut=w_cuttt
          tc=tc+1:cc=cc+1
          if tc=2 then
            tc=0:cnum=cnum-1
          end if
          if cc>5 then cnum=cnum-1:cc=0
        else
          cnum=cnum-1
          if cnum=0 then w_cut=w_cut"...":exit for
          w_cut=w_cuttt
        end if
      next
    End Function

    %>

    上一篇:突破空格的限制
    下一篇:本人常用的分页代码
  • 相关文章
  • 

    关于我们 | 付款方式 | 荣誉资质 | 业务提交 | 代理合作


    © 2016-2020 巨人网络通讯

    时间:9:00-21:00 (节假日不休)

    地址:江苏信息产业基地11号楼四层

    《增值电信业务经营许可证》 苏B2-20120278

    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信