作用:返回一个数组
语法:Array(list)
适用的类型:字符,数字均可
[中国站长站]
| 以下为引用的内容: <% Dim myArray() For i = 1 to 7 Redim Preserve myArray(i) myArray(i) = WeekdayName(i) Next %> |
结果:建立了一个包含7个元素的数组myArray
[中国站长站]
myArray("Sunday","Monday", ... ... "Saturday")
中.国站长站
CInt()
作用:将一个表达式转化为数字类型 中国站长.站
语法:CInt(表达式) Chinaz@com
适用的类型:任何有效的字符均可
| 以下为引用的内容: <% f = "234" response.write cINT(f) + 2 %> |
结果:236
转化字符"234"为数字234,如果字符串为空,则返回0值 中国站长.站
CreateObject()
作用:建立和返回一个已注册的ACTIVEX组件的实例。
语法:CreateObject(objName)
适用的类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字。 中国站.长.站
| 以下为引用的内容: <% Set con = Server.CreateObject("ADODB.Connection") %> CStr() |
作用:转化一个表达式为字符串。
语法:CStr(expression)
中国站.长站
适用类型:expression 是任何有效的表达式 中国站.长站
| 以下为引用的内容: <% s = 3 + 2 response.write("The 结果 is: " & cStr(s)) %> |
结果: 转化数字5为字符“5”。
Chinaz@com
Date() 中.国.站.长.站
作用:返回当前系统日期。 站.长站
语法:Date() 中.国.站.长.站
适用的类型:None。 中国.站.长站
<%=Date%>
结果:8/4/99
DateAdd() 中国.站长站
作用:返回一个被改变了的日期。
语法:DateAdd(timeinterval,number,date) 站.长站
说明:timeinterval为所要加入的时间间隔类型;number为要添加的数量;date为起始日期.
| 以下为引用的内容: <% 中.国站长站 <% 中.国站长站 结果:11/4/99 [中国站长站] 3:34:45 PM Chinaz@com "m" = "month"; 当当前日期格式为time,那么 站.长.站 "h" = "hour"; DateDiff() 中国.站长站 |
作用:返回两个日期之间的差值。
语法:DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear >>) 中国站.长站
说明:timeinterval 表示相隔时间的类型,如“M“表示“月”。
中国站长.站
| 以下为引用的内容: <% fromDate = #8/4/99# toDate = #1/1/2000# response.write("There are " & _ DateDiff("d",fromDate,toDate) & _ " days to millenium from 8/4/99." %> |
结果:There are150daysto millenium from 8/4/99
Day()
中国站长.站
作用:返回一个月的第几日。
中国.站.长站
语法:Day(date)
说明:date 是任何有效的日期。
Www~Chinaz~com
<%=Day(#8/4/99#)%>
中.国.站长站
结果:4
FormatCurrency() Chinaz_com
作用:返回表达式,此表达式已被格式化为货币值 Www.Chinaz.com
语法:FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit >>>>) Www~Chinaz~com
说明:Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置;LeadingDigit 三态常数,指示是否显示小数值小数点前面的零
Www.Chinaz.com
<%=FormatCurrency(34.3456)%>
Www@Chinaz@com
结果:$34.35
FormatDateTime() Chinaz.com
作用:返回表达式,此表达式已被格式化为日期或时间
语法:FormatDateTime(Date, [, NamedFormat >) Chinaz^com
说明:NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate. 中.国.站.长.站
<%=FormatDateTime("08/4/99", vbLongDate)%> Chinaz@com
结果:Wednesday, August 04, 1999 中国.站长站
FormatNumber() 中.国站长站
作用:返回表达式,此表达式已被格式化为数值
语法:FormatNumber(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit >>>>)
说明:Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的
数值。默认值为 -1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域
设置。; GroupDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置
<%=FormatNumber(45.324567, 3)%>
结果: 45.325 [中国站长站]
FormatPercent()
作用:返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%) 中.国站长站
语法:FormatPercent(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit >>>>) 中国站.长.站
说明:同上 [中国站长站]
<%=FormatPercent(0.45267, 3)%> 中国站长_站,为中文网站提供动力
结果: 45.267% 中国站长.站
Hour() 站长.站
作用:以24时返回小时数
站长.站
语法:Hour(time)
说明:
[中国站长站]
<%=Hour(#4:45:34 PM#)%> 站.长.站
结果:16 中国站.长站
Instr()
中国.站.长站
作用:返回字符或字符串在另一个字符串中第一次出现的位置.
中.国.站.长.站
语法:Instr([start, > strToBeSearched, strSearchFor [, compare>)
站长.站
说明:Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符compare 比较方式(详细见ASP常数)
| 以下为引用的内容: <% strText = "This is a test!!" pos = Instr(strText, "a") response.write pos %> |
结果:9
InstrRev() 中国站长.站
作用:同上,只是从字符串的最后一个搜索起
中.国.站长站
语法:InstrRev([start, > strToBeSearched, strSearchFor [, compare>) Chinaz.com
说明:同上.
中国站.长站
| 以下为引用的内容: <% strText = "This is a test!!" pos = InstrRev(strText, "s") response.write pos %> |
Chinaz.com
结果:13
Int()
作用:返回数值类型,不四舍五入。
语法:Int(number)
Www^Chinaz^com
说明:
<%=INT(32.89)%>
结果:32
IsArray()
中国站长_站,为中文网站提供动力
作用:判断一对象是否为数组,返回布尔值.
中.国站长站
语法:IsArray(name) 中国.站.长站
说明:
| 以下为引用的内容: <% strTest = "Test!" response.write IsArray(strTest) %> |
站长.站
结果:False
中国站长.站
IsDate() 中.国站长站
作用:判断一对象是否为日期,返回布尔值语法: IsDate(expression) 说明: expression is any valid expression. 站.长站
| 以下为引用的内容: <% strTest = "8/4/99" response.write IsDate(strTest) %> |
结果:True
IsEmpty() 中.国站长站
作用:判断一对象是否初始化,返回布尔值. 站长.站
语法:IsEmpty(expression)
中.国.站.长.站
说明: 站.长站
| 以下为引用的内容: <% Dim i response.write IsEmpty(i) %> |
结果:True
中国站长.站
IsNull()
Www~Chinaz~com
作用:判断一对象是否为空,返回布尔值. 站长.站
语法:IsNull(expression)
说明:
| 以下为引用的内容: <% Dim i response.write IsNull(i) %> |
结果:False 中.国.站长站
IsNumeric() Chinaz~com
作用:判断一对象是否为数字,返回布尔值.
语法:IsNumeric(expression)
Chinaz.com
说明:
| 以下为引用的内容: <% i = "345" response.write IsNumeric(i) %> |
Chinaz@com
结果:True
就算数字加了引号,ASP还是认为它是数字。 Www_Chinaz_com
IsObject()
Chinaz
作用:判断一对象是否为对象,返回布尔值. 站.长.站
语法:IsObject(expression)
站.长站
说明:
Chinaz_com
| 以下为引用的内容: <% Set con = Server.CreateObject( "ADODB.Connection") response.write IsObject(con) %> |
结果:True
Chinaz_com
LBound() 站.长站
作用:返回指定数组维的最小可用下标.
语法:Lbound(arrayname [, dimension >)
[中国站长站]
说明:dimension 指明要返回哪一维下界的整数。使用1表示第一维,2表示第二维,以此类推。如果省略 dimension 参数,默认值为 1. Www.Chinaz.com
| 以下为引用的内容: <% i = Array( "Monday","Tuesday","Wednesday") response.write LBound(i) %> |
Chinaz~com
结果:0
LCase()
作用:返回字符串的小写形式
语法:Lcase(string) 中国.站长站
说明:string is any valid string expression. Chinaz_com
| 以下为引用的内容: <% strTest = "This is a test!" response.write LCase(strTest) %> |
结果:this is a test!
中.国站长站
Left() 站.长.站
作用:返回字符串左边第length个字符以前的字符(含第length个字符). 中.国站长站
语法:Left(string, length)
Www^Chinaz^com
说明: 中国站.长站
| 以下为引用的内容: <% strTest = "This is a test!" response.write Left(strTest, 3) %> |
结果:Thi
Chinaz~com
Len()
作用:返回字符串的长度. [中国站长站]
语法:Len(string | varName)
中.国.站长站
说明:
| 以下为引用的内容: <% strTest = "This is a test!" response.write Len(strTest) %> |
结果:15 中国站.长.站
LTrim()
作用:去掉字符串左边的空格. Www_Chinaz_com
语法:LTrim(string) Chinaz.com
说明: 中.国站长站
| 以下为引用的内容: <% 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()
Chinaz^com
作用:返回时间的分钏.
站.长.站
语法:Minute(time)
中国站长_站,为中文网站提供动力
说明: Chinaz_com
<%=Minute(#12:45:32 PM#)%>
Chinaz.com
结果:45 站.长站
Month() 中.国.站.长.站
作用:返回日期. 中.国站长站
语法:Month(date) 站.长.站
说明:date is any valid date expression.
Chinaz.com
<%=Month(#08/04/99#)%> Www@Chinaz@com
结果:8
中国站长_站,为中文网站提供动力
MonthName()
站长.站
作用:Returns a string identifying the specified month.
中国.站长站
语法:MonthName(month, [, Abb >) Chinaz@com
说明:month is the numeric representation for a given month; Abb (optional) is a boolean value used to display month abbreviation. True will display the abbreviated month name and False (default) will not show the abbreviation.
Www^Chinaz^com
<%=MonthName(Month(#08/04/99#))%> Chinaz@com
结果:August Chinaz~com
Now()
[中国站长站]
作用:Returns the current system date and time.返回当前系统时间 Www@Chinaz@com
语法:Now() Chinaz@com
说明:None
Chinaz@com
<%=Now%>
结果:8/4/99 9:30:16 AM
Chinaz_com
Replace()
站长.站
作用:Returns a string in which a specified sub-string has been replaced with another substring a specified number of times.
语法:Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [, compare >>>)
| 以下为引用的内容: 说明:strToBeSearched is a string expression containing a sub-string to be replaced; strSearchFor is the string expression to search for within strToBeSearched; strReplaceWith is the string expression to replace sub-string strSearchFor; start (optional) is the numeric character position to begin search; count (optional) is a value indicating the comparision constant. <% strTest = "This is an apple!" response.write Replace(strTest, "apple", "orange") %> |
结果:This is an orange!
Right()
站.长站
作用:返回字符串右边第length个字符以前的字符(含第length个字符).
站.长.站
语法:Right(string, length)
说明: Chinaz.com
| 以下为引用的内容: <% strTest = "This is an test!" response.write Right(strTest, 3) %> |
结果:st! Www~Chinaz~com
Rnd() Chinaz^com
作用:产生一个随机数.
语法:Rnd [ (number) >
站长.站
说明: 中国站长.站
| 以下为引用的内容: <% Randomize() response.write RND() %> |
站长.站
结果:任何一个在0 到 1 之间的数 站长.站
Round() Www_Chinaz_com
作用:返回按指定位数进行四舍五入的数值.
语法:Round(expression [, numRight >) Chinaz^com
说明:numRight数字表明小数点右边有多少位进行四舍五入。如果省略,则 Round 函数返回整数.
| 以下为引用的内容: <% i = 32.45678 response.write Round(i) %> |
结果:32 Www~Chinaz~com
Rtrim()
作用:去掉字符串右边的空格字符串. 中国站.长.站
语法:Rtrim(string) Www.Chinaz.com
说明:
Chinaz^com
| 以下为引用的内容: <% strTest = "This is a test!! " response.write RTrim(strTest) %> |
结果:This is a test!! 站.长.站
Second() Www_Chinaz_com
作用:返回秒.
语法:Second(time) 中国站.长.站
说明: 中国站.长站
<%=Second(#12:34:28 PM#)%> 中.国.站.长.站
结果:28
Www.Chinaz.com
StrReverse()
作用:反排一字符串
语法:StrReverse(string)
说明 Www@Chinaz@com
| 以下为引用的内容: <% strTest = "This is a test!!" response.write StrReverse(strTest) %> |
结果:!!tset a si sihT Chinaz@com
Time()
作用:返回系统时间.
语法:Time()
说明:
Www_Chinaz_com
<%=Time%> Www@Chinaz@com
结果:9:58:28 AM
Trim()
Www.Chinaz.com
作用:去掉字符串左右的空格.
Chinaz^com
语法:Trim(string)
Chinaz_com
说明:string is any valid string expression. 站长.站
| 以下为引用的内容: <% strTest = " This is a test!! " response.write Trim(strTest) %> |
结果:This is a test!!
UBound()
Chinaz^com
作用:返回指定数组维数的最大可用下标.
语法:Ubound(arrayname [, dimension >)
说明:dimension (optional) 指定返回哪一维上界的整数。1 表示第一维,2 表示第二维,以此类推。如果省略 dimension 参数,则默认值为 1.
Www~Chinaz~com
| 以下为引用的内容: <% i = Array( "Monday","Tuesday","Wednesday") response.write UBound(i) %> |
结果:2
Www@Chinaz@com
UCase() 中国站.长站
作用:返回字符串的大写形式.
语法:UCase(string)
说明: 站长.站
| 以下为引用的内容: <% strTest = "This is a test!!" response.write UCase(strTest) %> |
结果:THIS IS A TEST!! Chinaz^com
VarType()
Chinaz^com
作用:返回指示变量子类型的值 Www^Chinaz^com
语法:VarType(varName)
[中国站长站]
说明:
| 以下为引用的内容: <% i = 3 response.write varType(i) %> |
结果:2(数字)详见 "asp常数"
中.国.站长站
WeekDay()
作用:返回在一周的第几天. Chinaz_com
语法:WeekDay(date [, firstdayofweek >) Www~Chinaz~com
说明:
| 以下为引用的内容: <% d = #8/4/99# response.write Weekday(d) %> |
结果:4(星期三) 中国站.长站
WeekDayName()
作用:返回一周第几天的名字. 中.国.站.长.站
语法:WeekDayName(weekday [, Abb [, firstdayofweek >>) Www^Chinaz^com
说明:Abb可选。Boolean 值,指明是否缩写表示星期各天的名称。如果省略, 默认值为 False,即不缩写星期各天的名称.firstdayofweek指明星期第一天的数值
Chinaz^com
| 以下为引用的内容: <% d = #8/4/99# response.write WeekdayName(Weekday(d)) %> |
Www~Chinaz~com
结果:Wednesday 站长.站
Year() Chinaz
作用:返回当前的年份. 中国站.长.站
语法:Year(date)
说明:
中.国.站长站
<%=Year(#8/4/99#)%> 中国站长.站
结果:1999