发布:goodtext,分类:编程开发,2009-4-6 7:59:4
'------------------------------------------------------------
'描述:让Len,Left,Right函数识别中文
' 对中文识别为两个字符,ASCII码为一个
' 可用此函数代替Len,Left,Right函数
'示例:LenX("中国ren") => "7"
' LeftX("中国ren",4) => "中国"
' RightX("中国ren",5) => "国ren"
'参数:
' sString 字符串
' lLength 长度
'返回:字符串长度,字符串,字符串
'整理:KimSoft(jinqinghua@gmail.com)
'时间:2005-05-24
'修改:2005-07-07
'------------------------------------------------------------
Public Function LenX(ByVal sString)
Dim reslult, lngStringLen, strCharString, i
lngStringLen = Len(sString)
strCharString = ""
for i = 1 to lngStringLen
strCharString = Mid(sString, i, 1)
if Asc(strCharString) > 0 then reslult= reslult+ 1 else reslult= reslult+ 2
next
LenX= reslult
End Function
Public Function strLeft(ByVal sString, ByVal lLength)
if isBlank(sString) or lLength < 1 then Exit Function
Dim result, lngStringLength, strCharString, lngCounter ,i
lngStringLength = Len(sString)
result = ""
for i = 1 to lngStringLength
strCharString = Mid(sString, i, 1)
result = result & strCharString
if Asc(strCharString) > 0 then lngCounter = lngCounter + 1 else lngCounter = lngCounter + 2
if lngCounter >= lLength then Exit For
next
strLeft = result
End Function
Public Function strRight(ByVal sString, ByVal lLength)
if isBlank(sString) or lLength < 1 then Exit Function
Dim result, lngStringLength, strCharString, lngCounter, i
lngStringLength = Len(sString)
result = ""
for i = lngStringLength to 1 step -1
strCharString = Mid(sString, i, 1)
result = strCharString & result
if Asc(strCharString) > 0 then lngCounter = lngCounter + 1 else lngCounter = lngCounter + 2
if lngCounter >= lLength then Exit For
next
strRight = result
End Function
把下列代码存为.ASP的文件,放在你的服务器上就可以直接运行了。
以下为引用的内容:
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%><html>
<head>
<title>网速测试</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<body style="cursor:wait;">
<p style="font-size:18pt;"><B>网速测试</B></p>
<p id="t" style="font-size:16pt;">正在测试,请稍候...</p>
<span style="width:300;height:16px;background-color:gray;"><span id="p" style="width:0;height:16px;background-color:red;"></span></span>
<script language="javascript">st = new Date();function $(p){document.getElementById("t").innerHTML="正在测试,请稍候...("+p+"%)";document.getElementById("p").style.width=p*3;}</script>
<%
defaultfs = 200 '数据默认大小(K)
minfs = 100 '数据最小值
maxfs = 500 '数据最高值
fs = Request("s")
if len(fs) = 0 or isnumeric(fs) = false then fs = defaultfs
if int(fs) > maxfs then fs = maxfs
if int(fs) < minfs then fs = minfs//webjx.com
for a=1 to fs%><!--$%^)!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()--><script language=javascript>$(<%=int(a*100/fs)%>)</script><%next%>
<script language=javascript>
et=new Date();ds=<%=fs%>;s=Math.round(ds*1000/(et-st)*10)/10;document.body.style.cursor='default';
nextsize=<%=fs%>;if(s>100){nextsize=<%=maxfs%>;}else if(s<20){nextsize=<%=minfs%>;}
document.getElementById("t").innerHTML="测试完毕。您的速度:<font color='red'>"+s+"</font>(K/秒) [<a href='?s="+nextsize+"&t="+Math.random()+"'>重测</a>]";</script>//webjx.com
</body>
</html>
将数据库连接代码封装在函数里,在需要读取时调用这个函数。 (2008-12-19 11:22:34)
读取和写入UTF-8编码的文件函数一则 (2008-11-22 17:49:7)
编写简单文章管理系统 - goodtext.org新闻&文章发布管理系统(GTArticle V1.0 ) (2008-10-19 8:58:16)
ASP动态网页下UTF-8页面乱码+GB2312转UTF-8 +生成UTF-8格式的文件(编码) (2008-10-2 8:20:12)
给网站加上RSS - Asp生成RSS的类 (2008-9-21 12:9:40)
说明:本函数作用是截取指定英汉混合字符串,并保持显示长度一至。就是将一个汉字当两英文来截取。 (2008-8-20 11:31:30)
一个asp版XMLDOM的类 (2008-8-20 8:26:5)
ASP操作XML文件创建,查询,修改等对xml操作的主要方法 (2008-7-26 14:17:29)
用fso\用ado.stream写xml文件 (2008-7-23 7:20:54)
操作文本的精典Function函数ASP+FSO (2008-7-22 10:23:7)