展会信息港展会大全

asp字符串截取函数 android软件开发教程
来源:互联网   发布日期:2016-03-01 11:41:19   浏览:1970次  

导读:本文章提供这款asp字符串截取函数原是是先用定义字符串判别函数判断字符串长度以及中英文,再把字符截取后定义超出部分内容的...显示方式&...

本文章提供这款asp字符串截取函数原是是先用定义字符串判别函数判断字符串长度以及中英文,再把字符截取后定义超出部分内容的...显示方式

function strvalue(str,lennum)

dim p_num

dim i

if strlen(str)<=lennum then

strvalue=str

else

p_num=0

x=0

do while not p_num > lennum-2

x=x+1

if asc(mid(str,x,1))<0 then

p_num=int(p_num) + 2

else

p_num=int(p_num) + 1

end if

strvalue=left(trim(str),x)&"…" '截取后定义超出部分内容的显示方式

loop

end if

end function

'定义字符串判别函数

function strlen(str)

dim p_len

p_len=0

strlen=0

if trim(str)<>"" then

p_len=len(trim(str))

for xx=1 to p_len

if asc(mid(str,xx,1))<0 then

strlen=int(strlen) + 2

else

strlen=int(strlen) + 1

end if

next

end if

end function

''截取字符串,1.包括前后字符串,2.不包括前后字符串

function strcut(strcontent,startstr,endstr,cuttype)

dim s1,s2

on error resume next

select case cuttype

case 1

s1 = instr(strcontent,startstr)

s2 = instr(s1,strcontent,endstr)+len(endstr)

case 2

s1 = instr(strcontent,startstr)+len(startstr)

s2 = instr(s1,strcontent,endstr)

end select

if err then

strcute = "<p align='center' ><font size=-1>截取字符串出错.</font></p>"

err.clear

exit function

else

strcut = mid(strcontent,s1,s2-s1)

end if

end function

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港