日期:2014-05-20 浏览次数:20788 次
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Cutstr()函数</title>
</head>
<body>
<h3>Cutstr()函数得到的结果:
</h3>
<%
with response
.Write(Cutstr("12日NBA:篮网欲签孟达控卫,凯尔特人提前集训",30)&"<br>")
.Write(Cutstr("绿衫军提前集训志在卫冕,皮尔斯盼戒指望眼欲穿",30)&"<br>")
.Write(Cutstr("NBA早报,魔术老将前锋退役,米勒期盼留在76人",30)&"<br>")
.Write(Cutstr("科比加索尔合刊66分,王牌湖人奥多兰‘变魔术’",30)&"<br>")
' .Write(Cutstr("<br>")
end with
%>
<h3>Left()函数得到的结果</h3>
<%
with response
.Write(left("12日NBA:篮网欲签孟达控卫,凯尔特人提前集训",15)&"<br>")
.Write(left("绿衫军提前集训志在卫冕,皮尔斯盼戒指望眼欲穿",15)&"<br>")
.Write(left("NBA早报,魔术老将前锋退役,米勒期盼留在76人",15)&"<br>")
.Write(left("科比加索尔合刊66分,王牌湖人奥多兰‘变魔术’",15)&"<br>")
end with
%>
<%
function Cutstr(Str,strlen)
dim l,t,c,i
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
if t >= strlen then
Cutstr = left(Str,i)
Exit For
else
Cutstr =str
End if
Next '第49行
Cutstr = Replace(Cutstr,CHr(10),"")
end function
%>
</body>
</html>