# asp常用函数(三)

FUNCTION: 返回字符串右边第length个字符以前的字符（含第length个字符).
SYNTAX: Right(string, length)
ARGUMENTS: .
EXAMPLE: <%
strTest = "This is an test!"
response.write Right(strTest, 3)
%>
RESULT: st!

Rnd()
FUNCTION: 产生一个随机数.
SYNTAX: Rnd [ (number) ]
ARGUMENTS:
EXAMPLE: <%
Randomize()
response.write RND()
%>
RESULT: 任何一个在0 到 1 之间的数

Round()
FUNCTION: 返回按指定位数进行四舍五入的数值.
SYNTAX: Round(expression [, numRight])
ARGUMENTS: numRight数字表明小数点右边有多少位进行四舍五入。如果省略，则
Round 函数返回整数.
EXAMPLE: <%
i = 32.45678
response.write Round(i)
%>
RESULT: 32

Rtrim()
FUNCTION: 去掉字符串右边的字符串.
SYNTAX: Rtrim(string)
ARGUMENTS:
EXAMPLE: <%
strTest = "This is a test!! "
response.write RTrim(strTest)
%>
RESULT: This is a test!!

Second()
FUNCTION: 返回秒.
SYNTAX: Second(time)
ARGUMENTS: .
EXAMPLE: <%=Second(#12:34:28 PM#)%>
RESULT: 28

StrReverse()
FUNCTION: 反排一字符串
SYNTAX: StrReverse(string)
ARGUMENTS:
EXAMPLE: <%
strTest = "This is a test!!"
response.write StrReverse(strTest)
%>
RESULT: !!tset a si sihT

Time()
FUNCTION: 返回系统时间.
SYNTAX: Time()
ARGUMENTS: .
EXAMPLE: <%=Time%>
RESULT: 9:58:28 AM

Trim()
FUNCTION: 去掉字符串左右的空格.
SYNTAX: Trim(string)
ARGUMENTS: string is any valid string expression.
EXAMPLE: <%
strTest = " This is a test!! "
response.write Trim(strTest)
%>
RESULT: This is a test!!

UBound()
FUNCTION: 返回指定数组维数的最大可用下标.
SYNTAX: Ubound(arrayname [, dimension])
ARGUMENTS: ; dimension (optional) 指定返回哪一维上界的整数。1 表示第一

EXAMPLE: <%
i = Array("Monday","Tuesday","Wednesday")
response.write UBound(i)
%>
RESULT: 2

UCase()
FUNCTION: 返回字符串的大写形式.
SYNTAX: UCase(string)
ARGUMENTS:
EXAMPLE: <%
strTest = "This is a test!!"
response.write UCase(strTest)
%>
RESULT: THIS IS A TEST!!

VarType()
FUNCTION: 返回指示变量子类型的值
SYNTAX: VarType(varName)
ARGUMENTS:
EXAMPLE: <%
i = 3
response.write varType(i)
%>
RESULT: 2(数字)详见"asp常数"

WeekDay()
FUNCTION: 返回在一周的第几天.
SYNTAX: WeekDay(date [, firstdayofweek])
ARGUMENTS: .
EXAMPLE: <%
d = #8/4/99#
response.write Weekday(d)
%>
RESULT: 4(星期三)

WeekDayName()
FUNCTION: 返回一周第几天的名字.
SYNTAX: WeekDayName(weekday [, Abb ][, firstdayofweek]])
ARGUMENTS: Abb可选。Boolean 值，指明是否缩写表示星期各天的名称。如果省

EXAMPLE: <%
d = #8/4/99#
response.write WeekdayName(Weekday(d))
%>
RESULT: Wednesday

Year()
FUNCTION: 返回当前的年份.
SYNTAX: Year(date)
ARGUMENTS:
EXAMPLE: <%=Year(#8/4/99#)%>
RESULT: 1999
• 本文已收录于以下专栏：

举报原因： 您举报文章：asp常用函数(三) 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)