- ·上一篇文章:ASP开发技巧--页面与程序分离
- ·下一篇文章:asp函数---InStr()
ASP函数大全
are比较方式(详细见ASP常数)
实例: 
<
%
strText 
= 
"
This 
is 
a 
test!!"
pos 
= 
Instr(strText, 
"
a"
)
response.write 
pos
%>
返回结果: 
9
InstrRev() 
函数同上,只是从字符串的最后一个搜索起
表达式 
InstrRev([start, 
] 
strToBeSearched, 
strSearchFor 
[, 
compare])
允许数据类型: 
同上.
实例: 
<
%
strText 
= 
"
This 
is 
a 
test!!"
pos 
= 
InstrRev(strText, 
"
s"
)
response.write 
pos
%>
返回结果: 
13
Int() 
函数返回数值类型,不四舍五入。
表达式 
Int(number)
允许数据类型:
实例: 
<
%=INT(32.89)%>
返回结果: 
32
IsArray() 
函数判断一对象是否为数组,返回布尔值 
.
表达式 
IsArray(name)
实例: 
<
%
strTest 
= 
"
Test!"
response.write 
IsArray(strTest)
%>
返回结果: 
False
IsDate() 
函数判断一对象是否为日期,返回布尔值
表达式 
IsDate(expression)
实例: 
<
%
strTest 
= 
"
9/4/2000"
response.write 
IsDate(strTest)
%>
返回结果: 
True
IsEmpty() 
函数判断一对象是否初始化,返回布尔值.
表达式 
IsEmpty(expression)
实例: 
<
%
Dim 
i
response.write 
IsEmpty(i)
%>
返回结果: 
True
IsNull() 
函数判断一对象是否为空,返回布尔值.
表达式 
IsNull(expression)
实例: 
<
%
Dim 
i
response.write 
IsNull(i)
%>
返回结果: 
False
IsNumeric() 
函数判断一对象是否为数字,返回布尔值.
表达式 
IsNumeric(expression)
实例: 
<
%
i 
= 
"
345"
response.write 
IsNumeric(i)
%>
返回结果: 
True
就算数字加了引号,ASP还是认为它是数字。
IsObject() 
函数判断一对象是否为对象,返回布尔值.
表达式 
IsObject(expression)
实例: 
<
%
Set 
con 
= 
Server.CreateObject("
ADODB.Connection"
)
response.write 
IsObject(con)
%>
返回结果: 
True
LBound() 
函数返回指定数组维的最小可用下标.
表达式 
Lbound(arrayname 
[, 
dimension])
实例: 
<
%
i 
= 
Array("
Monday"
,"
Tuesday"
,"
Wednesday"
)
response.write 
LBound(i)
%>
返回结果: 
0
LCase() 
函数 
返回字符串的小写形式
表达式 
Lcase(string)
实例: 
<
%
strTest 
= 
"
This 
is 
a 
test!"
response.write 
LCase(strTest)
%>
返回结果: 
this 
is 
a 
test!
Left() 
函数返回字符串左边第length个字符以前的字符(含第length个字符).
表达式 
Left(string, 
length)
实例: 
<
%
strTest 
= 
"
This 
is 
a 
test!"
response.write 
Left(strTest, 
3)
%>
返回结果: 
Thi
Len() 
函数返回字符串的长度.
表达式 
Len(string 
| 
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()
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%>
返回结果:&n
实例: 
<
%
strText 
= 
"
This 
is 
a 
test!!"
pos 
= 
Instr(strText, 
"
a"
)
response.write 
pos
%>
返回结果: 
9
InstrRev() 
函数同上,只是从字符串的最后一个搜索起
表达式 
InstrRev([start, 
] 
strToBeSearched, 
strSearchFor 
[, 
compare])
允许数据类型: 
同上.
实例: 
<
%
strText 
= 
"
This 
is 
a 
test!!"
pos 
= 
InstrRev(strText, 
"
s"
)
response.write 
pos
%>
返回结果: 
13
Int() 
函数返回数值类型,不四舍五入。
表达式 
Int(number)
允许数据类型:
实例: 
<
%=INT(32.89)%>
返回结果: 
32
IsArray() 
函数判断一对象是否为数组,返回布尔值 
.
表达式 
IsArray(name)
实例: 
<
%
strTest 
= 
"
Test!"
response.write 
IsArray(strTest)
%>
返回结果: 
False
IsDate() 
函数判断一对象是否为日期,返回布尔值
表达式 
IsDate(expression)
实例: 
<
%
strTest 
= 
"
9/4/2000"
response.write 
IsDate(strTest)
%>
返回结果: 
True
IsEmpty() 
函数判断一对象是否初始化,返回布尔值.
表达式 
IsEmpty(expression)
实例: 
<
%
Dim 
i
response.write 
IsEmpty(i)
%>
返回结果: 
True
IsNull() 
函数判断一对象是否为空,返回布尔值.
表达式 
IsNull(expression)
实例: 
<
%
Dim 
i
response.write 
IsNull(i)
%>
返回结果: 
False
IsNumeric() 
函数判断一对象是否为数字,返回布尔值.
表达式 
IsNumeric(expression)
实例: 
<
%
i 
= 
"
345"
response.write 
IsNumeric(i)
%>
返回结果: 
True
就算数字加了引号,ASP还是认为它是数字。
IsObject() 
函数判断一对象是否为对象,返回布尔值.
表达式 
IsObject(expression)
实例: 
<
%
Set 
con 
= 
Server.CreateObject("
ADODB.Connection"
)
response.write 
IsObject(con)
%>
返回结果: 
True
LBound() 
函数返回指定数组维的最小可用下标.
表达式 
Lbound(arrayname 
[, 
dimension])
实例: 
<
%
i 
= 
Array("
Monday"
,"
Tuesday"
,"
Wednesday"
)
response.write 
LBound(i)
%>
返回结果: 
0
LCase() 
函数 
返回字符串的小写形式
表达式 
Lcase(string)
实例: 
<
%
strTest 
= 
"
This 
is 
a 
test!"
response.write 
LCase(strTest)
%>
返回结果: 
this 
is 
a 
test!
Left() 
函数返回字符串左边第length个字符以前的字符(含第length个字符).
表达式 
Left(string, 
length)
实例: 
<
%
strTest 
= 
"
This 
is 
a 
test!"
response.write 
Left(strTest, 
3)
%>
返回结果: 
Thi
Len() 
函数返回字符串的长度.
表达式 
Len(string 
| 
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()
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%>
返回结果:&n
ASP函数大全