源码网,源码论坛,源码之家,商业源码,游戏源码下载,discuz插件,棋牌源码下载,精品源码论坛

 找回密码
 立即注册
查看: 448|回复: 18

[ASP编程] 截取实际长度字符串,并用空格替换

[复制链接]

7万

主题

861

回帖

32万

积分

论坛元老

Rank: 8Rank: 8

积分
329525
发表于 2006-6-20 00:00:00 | 显示全部楼层 |阅读模式

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=" "
strbuall=strbuall&strbu
next
thev=thestr&strbuall
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 cnum<0 then w_cut=w_cut&"...":exit for
    tt=mid(ctypes,ci,1)
    if int(asc(tt))>=0 then
      w_cut=w_cut&tt
      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_cut&tt
    end if
  next
End Function

%>

回复

使用道具 举报

9

主题

1万

回帖

420

积分

中级会员

Rank: 3Rank: 3

积分
420
发表于 2022-9-12 08:49:10 | 显示全部楼层
天天源码论坛
回复 支持 反对

使用道具 举报

0

主题

8878

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2022-11-26 15:52:59 | 显示全部楼层
还有人在不。。。。。。。。。。啊
回复 支持 反对

使用道具 举报

4

主题

1万

回帖

316

积分

中级会员

Rank: 3Rank: 3

积分
316
发表于 2023-1-19 18:07:41 | 显示全部楼层
借款金额看了就立刻
回复 支持 反对

使用道具 举报

3

主题

1万

回帖

163

积分

注册会员

Rank: 2

积分
163
发表于 2023-2-13 05:42:07 | 显示全部楼层
挺不错的东西
TS人妖演出表演服务q3268336102电话13168842816
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-2-21 03:40:46 | 显示全部楼层
终于找到了,我擦
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-4-22 05:12:39 | 显示全部楼层
不错的源码论坛
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

67

积分

注册会员

Rank: 2

积分
67
发表于 2023-5-9 11:07:10 | 显示全部楼层
的vgdsvsdvdsvdsvds
回复 支持 反对

使用道具 举报

0

主题

1万

回帖

0

积分

中级会员

Rank: 3Rank: 3

积分
0
发表于 2023-6-23 21:59:53 | 显示全部楼层
哈哈哈哈哈哈
回复 支持 反对

使用道具 举报

2

主题

1万

回帖

473

积分

中级会员

Rank: 3Rank: 3

积分
473
发表于 2023-7-13 14:17:37 | 显示全部楼层
额UI废物iuhfujewfiewnnfen
回复 支持 反对

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

手机版|小黑屋|网站地图|源码论坛 ( 海外版 )

GMT+8, 2024-9-20 12:05 , Processed in 0.089992 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表