最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp 截取字符串函数,计算一汉字等于2个英文
时间:2022-07-02 23:01:15 编辑:袖梨 来源:一聚教程网
'str 要截取的字符串
'strlen 截取字数
'str2 截取字符串后要加的字符。如:...
function gotTopic(str,strlen,str2)
if str="" or isnull(str) then
gotTopic=""
exit function
end if
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>cint(strlen) then
if str2<>"" then i=i-1
gotTopic=left(str,i-1) & str2
exit for
else
gotTopic=str
end if
next
gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
这个函数可以过滤html来截取哦,就是html与汉字混合的他也可以只截取中文哦。
相关文章
- 《Pokemon TCG》Mega Evolution - Chaos Rising 系列 Crobat 全图卡牌情报公开 04-25
- TGA年度最佳《光与影 33号远征队》销量爆炸 官宣突破八百万 04-25
- 刺客信条 黑旗记忆重置版现价格异常,豪华版短时直降10美元引热议 04-25
- 全本小说账号怎么注销 04-25
- 异环新手实用开荒建议指南 04-25
- 怎么解锁《Kiln》中的所有成就 04-25