盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

ASP 系列函数大全

时间:2024/12/4作者:未知来源:盾怪网教程人气:

[摘要]varName)   实例: <%  strTest = "This is a test!"  response.write Len(strTest)  %>   返...
varName) 
 
实例: <% 
 
strTest = "This is a test!" 
 
response.write Len(strTest) 
 
%> 
 
返回结果: 15 
 
 
LTrim() 
 
函数去掉字符串左边的空格. 
 
表达式 LTrim(string) 
 
实例: <% 
 
strTest = " This is a test!" 
 
response.write LTrim(strTest) 
 
%> 
 
返回结果: This is a test! 
 
 
Mid() 
 
函数返回特定长度的字符串(从start开始,长度为length). 
 
表达式 Mid(string, start [, length]) 
 
实例: <% 
 
strTest = "This is a test! Today is Monday." 
 
response.write Mid(strTest, 17, 5) 
 
%> 
 
返回结果: Today 
 
 
Minute() 
 
函数返回时间的分钟. 
 
表达式 Minute(time) 
 
实例: <%=Minute(#12:45:32 PM#)%> 
 
返回结果: 45 
 
 
Month() 
 
函数返回日期. 
 
表达式 Month(date) 
 
实例: <%=Month(#08/04/99#)%> 
 
返回结果: 8 
 
 
MonthName() 
 
函数返回指定月份 
 
表达式 MonthName(month, [, Abb]) 
 
实例: <%=MonthName(Month(#08/04/99#))%> 
 
返回结果: August 
 
 
Now() 
 
函数返回系统时间 
 
表达式 Now() 
 
实例: <%=Now%> 
 
返回结果: 9/9/00 9:30:16 AM 
 
 
Right() 
 
函数返回字符串右边第length个字符以前的字符(含第length个字符). 
 
表达式 Right(string, length) 
 
实例: <% 
 
strTest = "This is an test!" 
 
response.write Right(strTest, 3) 
 
%> 
 
返回结果: st! 
 
 
Rnd() 
 
函数产生一个随机数. 
 
表达式 Rnd [ (number) ] 
 
实例: <% 
 
Randomize()
[page_break]Rnd() 
 
函数产生一个随机数. 
 
表达式 Rnd [ (number) ] 
 
实例: <% 
 
Randomize() 
response.write RND() 
 
%> 
 
返回结果: 任何一个在0 到 1 之间的数 
 
 
Round() 
 
函数返回按指定位数进行四舍五入的数值. 
 
表达式 Round(expression [, numRight]) 
 
实例: <% 
 
i = 32.45678 
 
response.write Round(i) 
 
%> 
 
返回结果: 32 
 
 
Rtrim() 
 
函数去掉字符串右边的字符串. 
 
表达式 Rtrim(string) 
 
实例: <% 
 
strTest = "This is a test!! " 
 
response.write RTrim(strTest) 
 
%> 
 
返回结果: This is a test!! 
 
 
Split() 
 
函数将一个字符串分割并返回分割结果 
 
表达式 Split (S[,d]) 
 
实例:<%V= Split(A,B,C) 
 
For i = 0 To UBound(V) 
 
Response.Write V(i) 
 
Next 
 
%> 
 
返回结果: A B C 
 
 
Second() 
 
函数返回秒. 
 
表达式 Second(time) 
 
实例: <%=Second(#12:34:28 PM#)%> 
 
返回结果: 28 
 
 
StrReverse() 
 
函数反排一字符串 
 
表达式 StrReverse(string) 
 
实例: <% 
 
strTest = "This is a test!!" 
 
response.write StrReverse(strTest) 
 
%> 
 
返回结果: !!tset a si sihT 
 
 
Time() 
 
函数返回系统时间. 
 
表达式 Time() 
 
实例: <%=Time%> 
 
返回结果: 9:58:28 AM 
 
 
Trim() 
 
函数去掉字符串左右的空格. 
 
表达式 Trim(string) 
 
实例: <% 
 
strTest = " This is a test!! " 
 
response.write Trim(strTest) 
 
%> 
 
返回结果: This is a test!! 
 
 
UBound() 
 
函数返回指定数组维数的最大可用下标>. 
 
表达式 Ubound(arrayname [, dimension]) 
 
实例: <% 
 
i = Array("Monday","Tuesday","Wednesday") 
 
response.write UBound(i) 
 
%> 
 
返回结果: 2 
 
 
UCase() 
 
函数返回字符串的大写形式. 
 
表达式 UCase(string) 
 
允许数据类型: 
 
实例: <% 
 
strTest = "This is a test!!" 
 
response.write UCase(strTest) 
 
%> 
 
返回结果: THIS IS A TEST!! 
 
 
VarType() 
 
函数返回指示变量子类型的值 
 
表达式 VarType(varName) 
 
实例: <% 
 
i = 3 
 
response.write varType(i) 
 
%> 
 
返回结果: 2(数字)详见"asp常数" 
 
 
WeekDay() 
 
函数返回在一周的第几天. 
 
表达式 WeekDay(date [, firstdayofweek]) 
 
实例: <% 
 
d = #9/9/00# 
 
response.write Weekday(d) 
 
%> 
 
返回结果: 4(星期三) 
 
 
WeekDayName() 
 
函数返回一周第几天的名字. 
 
表达式 WeekDayName(weekday [, Abb [, firstdayofweek]]) 
 
实例: <% 
 
d = #9/9/00# 
 
response.write WeekdayName(Weekday(d)) 
 
%> 
 
返回结果: Wednesday 
 
 
Year() 
 
函数返回当前的年份. 
 
表达式 Year(date) 
 
实例: <%=Year(#9/9/00#)%> 
 
返回结果: 1999


关键词:ASP 系列函数大全




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版