教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp  >  正文 asp字符截取函数

asp字符截取函数

发布时间:2016-10-12   编辑:jiaochengji.com
教程集为您提供asp字符截取函数等资源,欢迎您收藏本站,我们将为您提供最新的asp字符截取函数资源

asp字符截取函数,取字符函数

<%
'定义字符串判别函数
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
'定义截取函数
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
str="的df萨芬ddsf埃担df罚df离开dfd旧爱对方哀伤的会计法"
response.Write(strvalue(str,11))
%>

您可能感兴趣的文章:
asp字符截取函数
php如何截取字符串后四位
asp字符串截取函数
php中文字符截取函数(自用)
php截取字符串(无乱码 utf8)
php中文截取字符串mb_substr的用法
php中文截取字符串函数(很好用)
php 字符串截取函数(可以自动清除网页标签)
php截取中文字符串的二个函数(iconv_substr和mb_substr)
如何防止SQL注入

[关闭]
~ ~