<
您还没有登录┊登录注册 当前在线:722
源码程序系统工具编程开发图形图像网络软件应用软件多媒体类娱乐休闲驱动程序各类教程各类论文文章阅读
ASPPHPJSPASP.NETVBVF百度搜索星星练题网络文摘股市消息技能习题详细分类
当前位置:首页 \ 源码程序 \ ASP代码 \ 其它类别
站内搜索


asp常用函数(1)

文件大小:20 k
运行平台:Windows9X/ME/NT/2000/XP
级别评定:
添加时间:2009-7-21 15:24:36
最后更新:2009-7-21 15:24:36
相关链接:无
所需金额:0 元
添加者:管理员

Download.1

/ ::软件简介:: / ::相关软件:: / ::软件点评:: /::上一个::/ ::下一个:: /
管理首页
asp常用函数

Array() 
 FUNCTION: 返回一个数组 
 SYNTAX: Array(list) 
 ARGUMENTS: 字符,数字均可 
 EXAMPLE: <%
Dim myArray()
For i = 1 to 7
  Redim Preserve myArray(i)
  myArray(i) = WeekdayName(i)
Next
%> 
 RESULT: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday") 
 
CInt() 
 FUNCTION: 将一个表达式转化为数字类型 
 SYNTAX: CInt(expression) 
 ARGUMENTS: 任何有效的字符均可 
 EXAMPLE: <%
f = "234"
response.write cINT(f) + 2
%> 
 RESULT: 236
转化字符"234"为数字"234",如果字符串为空,则返回0值  
 
CreateObject() 
 FUNCTION: 建立和返回一个已注册的ACTIVEX组件的实例。 
 SYNTAX: CreateObject(objName) 
 ARGUMENTS: objName 是任何一个有效、已注册的ACTIVEX组件的名字. 
 EXAMPLE: <%
Set con = Server.CreateObject("ADODB.Connection")
%> 
 RESULT: 
 
CStr() 
 FUNCTION: 转化一个表达式为字符串. 
 SYNTAX: CStr(expression) 
 ARGUMENTS: expression 是任何有效的表达式。 
 EXAMPLE: <%
s = 3 + 2
response.write "The result is: " & cStr(s)
%> 
 RESULT: 转化数字“5”为字符“5”。 
 
Date() 
 FUNCTION: 返回当前系统日期. 
 SYNTAX: Date() 
 ARGUMENTS: None. 
 EXAMPLE: <%=Date%> 
 RESULT: 8/4/99 
 
DateAdd() 
 FUNCTION: 返回一个被改变了的日期。 
 SYNTAX: DateAdd(timeinterval,number,date) 
 ARGUMENTS: timeinterval is the time interval to add; number is amount of 
time intervals to add; and date is the starting date. 
 EXAMPLE: <%
currentDate = #8/4/99#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%> 

<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%> 
 RESULT: 11/4/99
3:34:45 PM 

"m" = "month";
"d" = "day"; 

If currentDate is in time format then,
"h" = "hour"; 
"s" = "second"; 
 
DateDiff() 
 FUNCTION: 返回两个日期之间的差值 。 
 SYNTAX: DateDiff(timeinterval,date1,date2 [, firstdayofweek ][, 
firstweekofyear]]) 
 ARGUMENTS: timeinterval 表示相隔时间的类型,如“M“表示“月”。 
 EXAMPLE: <%
fromDate = #8/4/99#
toDate = #1/1/2000#
response.write "There are " & _
  DateDiff("d",fromDate,toDate) & _
  " days to millenium from 8/4/99."
%> 
 RESULT: 从8/4/99 到2000年还有 150 天. 
 
Day() 
 FUNCTION: 返回一个月的第几日 . 
 SYNTAX: Day(date) 
 ARGUMENTS: date 是任何有效的日期。 
 EXAMPLE: <%=Day(#8/4/99#)%> 
 RESULT: 4 
 
FormatCurrency() 
 FUNCTION: 返回表达式,此表达式已被格式化为货币值  
 SYNTAX: FormatCurrency(Expression [, Digit ][, LeadingDigit ][, Paren ][, 
GroupDigit]]]]) 
 ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是
计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的
零。 
 EXAMPLE: <%=FormatCurrency(34.3456)%> 
 RESULT: $34.35 
 
FormatDateTime() 
 FUNCTION: 返回表达式,此表达式已被格式化为日期或时间 
 SYNTAX: FormatDateTime(Date, [, NamedFormat]) 
 ARGUMENTS: NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用 
vbGeneralDate. 
 EXAMPLE: <%=FormatDateTime("08/4/99", vbLongDate)%> 
 RESULT: Wednesday, August 04, 1999 
 
FormatNumber() 
 FUNCTION: 返回表达式,此表达式已被格式化为数值. 
 SYNTAX: FormatNumber(Expression [, Digit ][, LeadingDigit ][, Paren ][, 
GroupDigit]]]]) 
 ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是
计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的数值。默认值为 -
1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认
值为 -1,指示使用的是计算机的区域设置。; GroupDigit i指示小数点右侧显示位数
的数值。默认值为 -1,指示使用的是计算机的区域设置。. 
 EXAMPLE: <%=FormatNumber(45.324567, 3)%> 
 RESULT: 45.325 
 
FormatPercent() 
 FUNCTION: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 
100 )。 (%) 
 SYNTAX: FormatPercent(Expression [, Digit ][, LeadingDigit ][, Paren ][, 
GroupDigit]]]]) 
 ARGUMENTS: 同上. 
 EXAMPLE: <%=FormatPercent(0.45267, 3)%> 
 RESULT: 45.267% 
 
Hour() 
 FUNCTION: 以24时返回小时数. 
 SYNTAX: Hour(time) 
 ARGUMENTS: 
 EXAMPLE: <%=Hour(#4:45:34 PM#)%> 
 RESULT: 16
(Hour has been converted to 24-hour system) 
 
Instr() 
 FUNCTION: 返回字符或字符串在另一个字符串中第一次出现的位置. 
 SYNTAX: Instr([start, ] strToBeSearched, strSearchFor [, compare]) 
 ARGUMENTS: Start为搜索的起始值,strToBeSearched接受搜索的字符串 
strSearchFor要搜索的字符.compare比较方式(详细见ASP常数) 
 EXAMPLE: <%
strText = "This is a test!!"
pos = Instr(strText, "a")
response.write pos
%> 
 RESULT: 9 
 
InstrRev() 
 FUNCTION: 同上,只是从字符串的最后一个搜索起 
 SYNTAX: InstrRev([start, ] strToBeSearched, strSearchFor [, compare]) 
 ARGUMENTS: 同上. 
 EXAMPLE: <%
strText = "This is a test!!"
pos = InstrRev(strText, "s")
response.write pos
%> 
 RESULT: 13 

 
Int() 
 FUNCTION: 返回数值类型,不四舍五入,注意取值是不大于它的整数。 
 SYNTAX: Int(number) 
 ARGUMENTS: 
 EXAMPLE: <%=INT(32.89)%>  <%=int(-3.33)%>
 RESULT: 32  -4
 
IsArray() 
 FUNCTION: 判断一对象是否为数组,返回布尔值 . 
 SYNTAX: IsArray(name) 
 ARGUMENTS: 
 EXAMPLE: <%
strTest = "Test!"
response.write IsArray(strTest)
%> 
 RESULT: False 
 
IsDate() 
 FUNCTION: 判断一对象是否为日期,返回布尔值 
 SYNTAX: IsDate(expression) 
 ARGUMENTS: expression is any valid expression. 
 EXAMPLE: <%
strTest = "8/4/99"
response.write IsDate(strTest)
%> 
 RESULT: True 
 
IsEmpty() 
 FUNCTION: 判断一对象是否初始化,返回布尔值. 
 SYNTAX: IsEmpty(expression) 
 ARGUMENTS: 
 EXAMPLE: <%
Dim i
response.write IsEmpty(i)
%> 
 RESULT: True 
 
IsNull() 
 FUNCTION: 判断一对象是否为空,返回布尔值. 
 SYNTAX: IsNull(expression) 
 ARGUMENTS: 
 EXAMPLE: <%
Dim i
response.write IsNull(i)
%> 
 RESULT: False 
 
IsNumeric() 
 FUNCTION: 判断一对象是否为数字,返回布尔值. 
 SYNTAX: IsNumeric(expression) 
 ARGUMENTS: 
 EXAMPLE: <%
i = "345"
response.write IsNumeric(i)
%> 
 RESULT: True
就算数字加了引号,ASP还是认为它是数字。 
 
IsObject() 
 FUNCTION: 判断一对象是否为对象,返回布尔值. 
 SYNTAX: IsObject(expression) 
 ARGUMENTS: 
 EXAMPLE: <%
Set con = Server.CreateObject("ADODB.Connection")
response.write IsObject(con)
%> 
 RESULT: True 
 
LBound() 
 FUNCTION: 返回指定数组维的最小可用下标. 
 SYNTAX: Lbound(arrayname [, dimension]) 
 ARGUMENTS:  dimension 指明要返回哪一维下界的整数。使用 1 表示第一维,2 
表示第二维,以此类推。如果省略 dimension 参数,默认值为 1. 
 EXAMPLE: <%
i = Array("Monday","Tuesday","Wednesday")
response.write LBound(i)
%> 
 RESULT: 0 
 
LCase() 
 FUNCTION:  返回字符串的小写形式 
 SYNTAX: Lcase(string) 
 ARGUMENTS: string is any valid string expression. 
 EXAMPLE: <%
strTest = "This is a test!"
response.write LCase(strTest)
%> 
 RESULT: this is a test! 
 
Left() 
 FUNCTION: 返回字符串左边第length个字符以前的字符(含第length个字符). 
 SYNTAX: Left(string, length) 
 ARGUMENTS: 
 EXAMPLE: <%
strTest = "This is a test!"
response.write Left(strTest, 3)
%> 
 RESULT: Thi 
 
Len() 
 FUNCTION: 返回字符串的长度. 
 SYNTAX: Len(string | varName) 
 ARGUMENTS: 
 EXAMPLE: <%
strTest = "This is a test!"
response.write Len(strTest)
%> 
 RESULT: 15 
 
LTrim() 
 FUNCTION: 去掉字符串左边的空格. 
 SYNTAX: LTrim(string) 
 ARGUMENTS: 
 EXAMPLE: <%
strTest = " This is a test!"
response.write LTrim(strTest)
%> 
 RESULT: This is a test! 
 
Mid() 
 FUNCTION: 返回特定长度的字符串(从start开始,长度为length). 
 SYNTAX: Mid(string, start [, length]) 
 ARGUMENTS: 
 EXAMPLE: <%
strTest = "This is a test! Today is Monday."
response.write Mid(strTest, 17, 5)
%> 
 RESULT: Today 
 
Minute() 
 FUNCTION: 返回时间的分钏. 
 SYNTAX: Minute(time) 
 ARGUMENTS: 
 EXAMPLE: <%=Minute(#12:45:32 PM#)%> 
 RESULT: 45 
 
Month() 
 FUNCTION: 返回日期. 
 SYNTAX: Month(date) 
 ARGUMENTS: date is any valid date expression. 
 EXAMPLE: <%=Month(#08/04/99#)%> 
 RESULT: 8 
 
MonthName() 
 FUNCTION: Returns a string identifying the specified month. 
 SYNTAX: MonthName(month, [, Abb]) 
 ARGUMENTS: 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. 
 EXAMPLE: <%=MonthName(Month(#08/04/99#))%> 
 RESULT: August 
 
Now() 
 FUNCTION: Returns the current system date and time. 
 SYNTAX: Now() 
 ARGUMENTS: None 
 EXAMPLE: <%=Now%> 
 RESULT: 8/4/99 9:30:16 AM 
 
Replace() 
 FUNCTION: Returns a string in which a specified sub-string has been 
replaced with another substring a specified number of times. 
 SYNTAX: Replace(strToBeSearched, strSearchFor, strReplaceWith [, start 
][, count ][, compare]]]) 
 ARGUMENTS: 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. 
 EXAMPLE: <% 
strTest = "This is an apple!"
response.write Replace(strTest, "apple", "orange")
%> 
 RESULT: This is an orange! 
 
Right() 
 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 表示第一
维,2 表示第二维,以此类推。如果省略 dimension 参数,则默认值为 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 值,指明是否缩写表示星期各天的名称。如果省
略, 默认值为 False,即不缩写星期各天的名称.firstdayofweek指明星期第一天的
数值 
 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函数大全
 
Abs(number) 


返回绝对值。 

Array(arglist) 

创建一个数组。 

Asc(string) 

返回字符串第一个字符的ANSI码。 

Atn(number) 

返回反正弦值。 

CBool (expression)  

转换成Boolean数据类型变量。 

CByte (expression)  

转换成Byte数据类型变量。 

CCur (expression)  

转换成Currency数据类型变量。 

CDate (expression)  

转换成Date数据类型变量。 

CDbl (expression)  

转换成Double数据类型变量。 

Chr(charcode) 

把ANSI 码转换成相应的键盘字符。 

CInt (expression)  

转换成Integer数据类型变量。 

CLng (expression)  

转换成Long数据类型变量。 

CreateObject(servername.typename) 

创建一个自动对象。 

CSng (expression)  

转换成Single数据类型变量。 

CStr (expression)  

转换成String数据类型变量。 

Date 

根据所用的系统返回时间。 

DateAdd(interval,number,date) 

向date对象添加指定的时间间隔。其中参数interval 接受下表所示的值。 

设定值
描述 

yyyy
年 

q
季度 

m
月份 

y
一年的第几天 

d
天 

w
星期几 

ww
一年的第几个星期 

h
小时 

m
分钟 

s
秒钟 


  

DateDiff(interval,date1,date2[,firstdayofweek[,firstweekofyear]]) 

返回两个日期之间的间隔,关于firstdayofweek及firstweekofyear的值请参考下面的“日期和时间常数”一节。interval参数接受下表所示的值。 

设定值
描述 

yyyy
年 

q
季度 

m
月份 

y
一年的第几天 

d
天 

w
星期几 

ww
一年的第几个星期 

h
小时 

m
分钟 

s
秒钟 


  

DatePart(interval , date[,firstdayofweek[,firstweekofyear]])  

返回Date对象指定部分。关于firstdayofweek及firstweekofyear的值请参考下面的“日期和时间常数”一节。interval参数接受下表所示的值。 

设定值
描述 

yyyy
年 

q
季度 

m
月份 

y
一年的第几天 

d
天 

w
星期几 

ww
一年的第几个星期 

h
小时 

m
分钟 

s
秒钟 


  

DateSerial(year,month,day) 

转换成Date数据子类型变体值。 

Datevalue(date) 

转换成Date数据子类型变体值。 

Day(date) 

根据参数date返回该天在一个月中的号数。 

Exp(number) 

返回e的number次方的值。 

Filter(InputStrings,value[,Include[,Compare]]) 

根据筛选条件创建一个新的数组。关于Compare的值,请参看后面“比较常数”一节。 

Fix(number) 

转换成一个整数(对于负数,只入不舍)。 

FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit[,UseParensForNegativeNumbers [,GroupDigit]]]]) 

格式化成currency形式。关于IncludeleadingDigit,UseParensForNegativeNumbers及GroupDigit的值请参看后面“三态常数”一节。 

FormatDateTime(Date[,NamedFormat]) 

对日期及时间进行格式化输出。关于NamedFormat的值请参看后面“日期格式常数”一节。 

FormatNumber(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit[,UseParensForNegativeNumbers [,GroupDigit]]]]) 

对数字进行格式化。关于IncludeleadingDigit,UseParensForNegativeNumbers及GroupDigit的值请参看后面“三态常数”一节。 

FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit[,UseParensForNegativeNumbers [,GroupDigit]]]]) 

对百分数进行格式化。关于IncludeleadingDigit,UseParensForNegativeNumbers及GroupDigit的值请参看后面“三态常数”一节。 

GetObject([pathname][,class]) 

从指定的文件中返回指定的动态对象。 

Hex(number) 

返回数number的十六进制的值。 

Hour(time) 

根据参数time的值返回小时。 

InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context]) 

显示一个临时的输入框,并且返回用户的输入。 

InStr([start,]string1,string2[,compare])  

返回字符串string2在字符串string1中第一次出现的位置。关于compare的值请参看后面的“比较常数”一节。 

InStrRev(string1,string2 [start [,compare]])  

返回字符串string2在字符串string1中最后出现的位置。关于compare的值请参看后面的“比较常数”一节。 

Int(number) 

返回一个整数(负数只舍不入)。 

IsArray(varname) 

确定变量是否是一个数组。 

IsDate(expression) 

确定表达式expression能否转换成日期格式。 

IsEmpty(varname) 

确定变量是否已经初始化了。 

IsNull(expression) 

确定表达式expression是否为空。 

IsNumberic(expression) 

确定表达式expression的结果是否是一个数。 

IsObject(expression) 

确定表达式expression是否是一个自动对象。 

Join(list,[,delimiter]) 

把一个数组中的所有子字符串连接起来,连接所用的分隔符由delimiterd的值设定。 

LBound(arrayname[,dimension]) 

返回数组某维的最低界限。在当前的VBScript版本中,该函数总是返回值0。 

Lcase(string) 

以小写字符格式化。 

Left(string,length) 

返回指定长度的字符串string左部分。 

Len(string|varname) 

返回字符串string的长度或变量varname的字节长度。 

LoadPicture(pitcurename) 

载入一个图片对象。 

Log(number) 

返回数number的自然对数值。 

Ltrim(string) 

删除字符串string左边多余的空格。 

Mid(strin,start[,length]) 

返回指定长度的字符串string的子串。 

Minute(time) 

根据参数time的值返回分钟的值。 

Month(date) 

返回以数字表示的月份。 

MonthName(month[,abbreviate]) 

返回以名称表示的月份。 

MsgBox(prompt[,buttons][,title][helpfile,context]) 

显示一个消息框,要求用户选择一个按钮,返回能指明用户所做选择的值。关于button的值和返回值请参看后面“消息框常数”一节。 

Now 

根据系统,返回当前的日期和时间。 

Oct(number) 

返回数number的八进制值。 

Replace(expression,find,replacewith[,start[,count[,compare]]]) 

用指定的子字符串replacewith替换指定的子字符串find指定的次数。关于参数compare的值请参看后面“比较常数”一节。 

Right(string,length) 

返回指定长度的字符串string的右部分子串。 

Rnd([number]) 

产生一个随机数。 

Round(number[,numdecimalplaces]) 

根据指定的十进制位数对数number进行四舍五入。 

RTrim(string) 

删除字符串string右边多余的空格。 

ScriptEngine 

返回使用的脚本语言的名称。 

ScriptEngineBuildVersion 

返回使用的脚本引擎版本。 

ScriptEngineMaorVersion 

返回使用的脚本引擎的大版本号。 

Second(time) 

根据参数time的值返回该分的第几秒。 

Sgn(number) 

返回数number的正负号。 

Sin(number) 

返回数number的正弦值。 

Space(number) 

用指定数量的空格创建字符串。 

Split(expression[,delimiter[,count[,compare]]]) 

把一个字符串分割并转换成数组。关于compare的值请参看后面“比较常数”一节。 

Sqr(number) 

返回数number的平方根值。 

StrComp(string1,string2[,compare]) 

字符串比较。关于compare的值请参看后面“比较常数”一节。 

StrReverse(string1) 

对字符串string1进行倒序。 

String(number,character) 

用number个字符character创建字符串。 

Tan(number) 

返回数number的正切。 

Time 

根据系统返回当前时间。 

TimeSerial(hour,minute,second) 

返回Date变量体。 

Timevalue(time) 

返回包含时间的Date变量体。 

Trim(string) 

删除字符串string两边的多余空格。 

TypeName(varname) 

返回子类型的名称。关于返回值请参看后面“变量类型常数”一节。 

UBound(arrayname[,dimension]) 

返回数组某维的上边界。缺省维数时,为第一维。 

Ucase(string) 

用大写字母格式格式化字符串string。 

VarType(varname) 

返回子类型的值。关于返回值请参看后面“变量类型常数”一节。 

Weekday(date,[firstdayofweek]) 

用数字形式返回星期几。关于参数firstdayofweek的值请参看后面“变量类型常数”一节。 

WeekDayName(weekday,abbreviate,firstdayofweek) 

用名称形式返回星期几。关于参数firstdayofweek的值请参看后面“变量类型常数”一节。 

Year(date) 

根据参数date返回年份。

asp 中处理文件上传以及删除时常用的自定义函数:  


  <% 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  '所有自定义的VBS函数 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  function DeleteFile(Filename) '删除文件 
  if Filename<>"" then 
  Set fso = server.CreateObject("Scripting.FileSystemObject") 
  if fso.FileExists(Filename) then 
  fso.DeleteFile Filename 
  end if 
  set fso = nothing 
  end if 
  end function 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  function CreateDIR(byval LocalPath) '建立目录的程序,如果有多级目录,则一级一级的创建 
  on error resume next 
  LocalPath = replace(LocalPath,"\","/") 
  set FileObject = server.createobject("Scripting.FileSystemObject") 
  patharr = split(LocalPath,"/") 
  path_level = ubound(patharr) 
  for i = 0 to path_level 
  if i=0 then pathtmp=patharr(0) & "/" else pathtmp = pathtmp & patharr(i) & "/" 
  cpath = left(pathtmp,len(pathtmp)-1) 
  if not FileObject.FolderExists(cpath) then FileObject.CreateFolder cpath 
  next 
  set FileObject = nothing 
  if err.number<>0 then 
  CreateDIR = false 
  err.Clear 
  else 
  CreateDIR = true 
  end if 
  end function  

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  function SaveRandFileName(byval szFilename) '根据原文件名生成新的随机文件名 
  randomize 
  'ranNum=int(90000*rnd)+10000 
  'if month(now)<10 then c_month="0" & month(now) else c_month=month(now) 
  'if day(now)<10 then c_day="0" & day(now) else c_day=day(now) 
  'if hour(now)<10 then c_hour="0" & hour(now) else c_hour=hour(now) 
  'if minute(now)<10 then c_minute="0" & minute(now) else c_minute=minute(now) 
  'if second(now)<10 then c_second="0" & second(now) else c_second=minute(now) 
  fileExt_a=split(szFilename,".") 
  fileExt=lcase(fileExt_a(ubound(fileExt_a)))  

  SaveRandFileName=replace(replace(replace(now,":",""),"-","")," ","")&int(10*rnd)&"."&fileExt   
  'GenerateRandomFileName = year(now)&c_month&c_day&c_hour&c_minute&c_second&"_"&ranNum&"."&fileExt 
  end function 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 

 function jaron_replacer(strContent,start_string,end_string,replace_string) 
  'CMS替换函数:源字符串,前部分,后部分,替换成的字符 
  '返回被替换后的字符串 
  jaron_replacer = replace(strContent,mid(strContent,instr(strContent,start_string),instr(strContent,end_string)+len(end_string)-1),replace_string) 
  end function 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  function replaceplus(strContent,start_string,end_string,replace_string) 
  '文档中,将所有开始,结束之间的所有字符删除 
  on error resume next 
  MARKCOUNTS = ubound(split(strContent,start_string)) 
  PRESTRING = strContent 
  for i=0 to MARKCOUNTS 
  STARTMARK=instr(1,PRESTRING,start_string,1) 
  if STARTMARK=0 then exit for 
  COMPMARK=instr(1,PRESTRING,end_string,1) + len(end_string) 
  VerString=mid(PRESTRING,STARTMARK,COMPMARK - STARTMARK) 
  PRESTRING = replace(PRESTRING,VerString,replace_string) 
  next 
  replaceplus = PRESTRING 
  if err.number<>0 then err.Clear 
  end function 
  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  %> 

检测一个字符串在另一个字符串当中出现几次的函数 


Function CheckTheChar(TheChar,TheString)
'TheChar="要检测的字符串"
'TheString="待检测的字符串"
if inStr(TheString,TheChar) then
for n =1 to Len(TheString)
if Mid(TheString,n,Len(TheChar))=TheChar then 
CheckTheChar=CheckTheChar+1
End if
Next
CheckTheChar="这个字符"&CheckTheChar&"次"
else
CheckTheChar="0次"
end if
End Function 

example:
Response.write CheckTheChar("大家","a224大家4a434a4大家654arewr4a4a" )

半角<=>全角互转函数[JS版 VBS版] 


<script>
/*
****************************
*     半角<=>全角    *
*         [NB联盟]         * 
*     Writer  YuPing       *
****************************
* 参数说明:
*  str:要转换的字符串
*  flag:标记,为0时半转全,为非0时全转半
*  返回值类型:字符串
****************************
*/
function DBC2SBC(str,flag) {
 var i;
 var result='';
 if (str.length<=0) {alert('字符串参数出错');return false;}
  for(i=0;i<str.length;i++) 
  { str1=str.charCodeAt(i);
    if(str1<125&&!flag)
     result+=String.fromCharCode(str.charCodeAt(i)+65248);
     else
     result+=String.fromCharCode(str.charCodeAt(i)-65248);
  }
 return result;
 }
 //示例:
alert(DBC2SBC("AAabc",0));
document.write(DBC2SBC("abcdefg",0))
</script>
<input type=text value="abcdefg" id=txt><input type=button value="变" onclick=txt.value=DBC2SBC(txt.value)> 


<script language="vbscript">
'****************************
'*     半角<=>全角    *
'*         [NB联盟]         * 
'*     Writer  YuPing       *
'****************************
'* 参数说明:
'*  str:要转换的字符串
'*  flag:标记,为0时半转全,为非0时全转半
'*  返回值类型:字符串
'****************************
function DBC2SBC(str,flag) 
 dim i
 if len(str)<=0 then 
     msgbox '字符串参数出错'
     exit function
 end if
    for i=1 to len(str)
    str1=asc(mid(str,i,1))
     if str1>0 and str1<=125 and not flag then 
       dbc2sbc=dbc2sbc&chr(asc(mid(str,i,1))-23680)
     else
       dbc2sbc=dbc2sbc&chr(asc(mid(str,i,1))+23680)
     end if
    next
end function
'示例:
alert(dbc2sbc("AB",1))
</script>

截取固定字数 


<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> 
function DoTrimProperly(str, nNamedFormat, properly, pointed, points)
  dim strRet
  strRet = Server.HTMLEncode(str)
  strRet = replace(strRet, vbcrlf,"")
  strRet = replace(strRet, vbtab,"")
  If (LEN(strRet) > nNamedFormat) Then
    strRet = LEFT(strRet, nNamedFormat)   
    If (properly = 1) Then     
      Dim TempArray        
      TempArray = split(strRet, " ") 
      Dim n
      strRet = ""
      for n = 0 to Ubound(TempArray) - 1
        strRet = strRet & " " & TempArray(n)
      next
    End If
    If (pointed = 1) Then
      strRet = strRet & points
    End If
  End If
  DoTrimProperly = strRet
End Function
</SCRIPT> 

列如:
<% =(DoTrimProperly((rsh.Fields.Item("n_title").value), 10, 0, 1, "...")) %> 

检验表单 


<script language="javascript">
<!--
function isEmpty(s)
{
return ((s == null) || (s.length == 0))
}
function isWhitespace (s)
{
var whitespace = " \t\n\r";
var i;
// 以下代码判断是否有空字符
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (whitespace.indexOf(c) >= 0)
{
return true;
}

return false;
}
function isCharsInBag (s, bag)
{
var i;
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if (bag.indexOf(c) == -1) return false;
}
return true;
}
function isEmail (s)
{
//判断Email是否为空
if (isEmpty(s))
{
window.alert("输入的E-mail地址不能为空,请输入!");
return false;
}
//判断Email中是否包含空格
if (isWhitespace(s))
{
window.alert("输入的E-mail地址中不能包含空格符,请重新输入!");
return false;
}
//判断Email地址长度
var i = 1;
var len = s.length;
if (len > 100)
{
window.alert("Email地址长度不能超过100位!");
return false;
}
pos1 = s.indexOf("@");
pos2 = s.indexOf(".");
pos3 = s.lastIndexOf("@");
pos4 = s.lastIndexOf(".");
//判断Email地址中是否包含符号 "@" 
if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))
{
window.alert("请输入有效的E-mail地址!");
return false;
}
else
{
if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1)
|| ( pos1 != pos3 ) //find two @
|| ( pos4 < pos3 ) ) //. should behind the "@"
{
window.alert("请输入有效的E-mail地址!");
return false;
}
}
if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
{
window.alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@\n" + "请重新输入" );
return false;
}
//判断是否包含有效的字符
/*
var badChar = "><,[]{}?/+=|\\"\":;!#$%^&()`";
if ( isCharsInBag( s, badChar))
{
alert("请不要在email地址中输入字符 " + badChar + "\n" );
alert("请重新输入" );
return false;
}
*/
return true;
}
function checkdata() {
if (document.form1.Email.value=="") {
window.alert ("请输入您的E-mail地址 !")
return false
}
if ( !isEmail(document.form1.Email.value) )
return false
if (document.form1.Pass.value=="") {
window.alert ("请输入您的密码 !")
return false
}
if (document.form1.Pass.value.length<5) {
window.alert ("您的密码数必须大于4位 !")
return false
}
if (document.form1.Pass.value.length>10) {
window.alert ("您的密码数必须小于10位 !")
return false
}
if (document.form1.Comfpass.value=="") {
window.alert ("请输入您的确认密码 !")
return false
}
if (document.form1.Pass.value!=document.form1. Comfpass.value) {
window.alert ("您的密码不一致 !")
return false
}
if (document.form1.Pass_question.value=="") {
window.alert ("请输入您取回密码的问题 !")
return false
}
if (document.form1. Pass_answer.value=="") {
window.alert ("请输入您取回密码的答案!")
return false
}
if (document.form1.Name.value=="") {
window.alert ("请输入您的真实姓名 !")
return false
}
if (document.form1.City.value=="") {
window.alert ("请输入所在城市 !")
return false
}
if (document.form1.Address.value=="") {
window.alert ("请输入您的详细地址 !")
return false
}
if (document.form1.Zip.value=="") {
window.alert ("请输入您的邮编 !")
return false
}
if (document.form1.Phone.value=="") {
window.alert ("请输入您的电话号码 !")
return false
}
if (document.form1.fax.value=="") {
window.alert ("请输入您的传真号码 !")
return false
}
if (document.form1.mobil.value=="") {
window.alert ("请输入您的手机号码 !")
return false
}
return true
}
//-->
</script>
例如:
<form name="form1" method="POST" action="/cinfocheck.asp" onSubmit="return checkdata()">

转换空格和回车 


<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT> 
function DoWhiteSpace(str) 
DoWhiteSpace = Replace((Replace(str, vbCrlf, "<br>")), chr(32)&chr(32), "  ") 
End Function 
</SCRIPT>  

例子:N_Content=DoWhiteSpace(Request.Form("N_Content")) 

按要求弹窗口转向 


if (confirm("到 a.htm 吗?"))
{
window.location.href="a.htm";
}
else
{
window.location.href="b.htm";
}

按钮倒记时效果 


<script language="javascript">
var secs = 9;
var wait = secs * 1000;
document.form1.rulesubmit.value = "同 意(" + secs + ")";
document.form1.rulesubmit.disabled = true;
for(i = 1; i <= secs; i++) {
        window.setTimeout("update(" + i + ")", i * 1000);
}
window.setTimeout("timer()", wait);
function update(num, value) {
        if(num == (wait/1000)) {
                document.form1.rulesubmit.value = "同 意";
        } else {
                printnr = (wait / 1000)-num;
                document.form1.rulesubmit.value = "同 意(" + printnr + ")";
        }
}
function timer() {
        document.form1.rulesubmit.disabled = false;
        document.form1.rulesubmit.value = "同 意";
}
</script> 

<form name="form1" method="post" action="">
<input type="submit" name="rulesubmit" value="同 意" style="height: 23px">
</form> 

全选和取消全选 


<SCRIPT language="javascript">
function checkAll(bCheck)
{
    var arr = document.all.chk;
    for(var i=0; i<arr.length; i++)
    {
        if(!arr[i].disabled == true)
            arr[i].checked = bCheck;
    }
}
</SCRIPT>
<INPUT TYPE="checkbox" NAME="all" onclick="checkAll(this.checked)"><p>
<INPUT TYPE="checkbox" NAME="chk">
<INPUT TYPE="checkbox" NAME="chk">
<INPUT TYPE="checkbox" NAME="chk" disabled>
<INPUT TYPE="checkbox" NAME="chk">
<INPUT TYPE="checkbox" NAME="chk"> 

在当前位置加入指定字符
<HTML>
     <HEAD>
     <SCRIPT>
     function insertAtCaret (textEl, text) {
textEl.focus();
document.selection.createRange().text=text;
     }
     </SCRIPT>
     </HEAD>
     <BODY>
     <FORM NAME="aForm">
     <TEXTAREA NAME="aTextArea" ROWS="5" COLS="80" WRAP="soft">测试测试测试测试测 


试测试
     </TEXTAREA>
     <BR>
     <INPUT TYPE="text" NAME="aText" SIZE="80" value="要插入的文字">
     <BR>
     <INPUT TYPE="button" value="insert"  

onCLICK="insertAtCaret(this.form.aTextArea,this.form.aText.value);">
     </FORM>
     </BODY>
     </HTML> 

找到2个tag之间的内容 


<%
Function RegGetString(expression)
Dim reg
Set reg = New RegExp
reg.IgnoreCase = True
reg.Global = True
reg.Pattern = "(.*?)<!--A-->(.*?)<!--B-->(.*?)"
RegGetString= reg.Replace(expression,"$1<hello>$2")
Set reg =nothing
End Function
%>
<% = RegGetString("标记外1<!--A-->记录一<!--B-->标记外2<!--A-->记录二<!--B-->标记外3") %> 

ASP语法速查表 
 
作者:佚名    文章来源:不详    点击数:1302    更新时间:2004-10-16 
 
VBScript 函数 
 功能说明 
 例子 
 
Abs (数值) 绝对值。一个数字的绝对值是它的正值。空字符串 (null) 的绝对值,也是空字符串。未初始化的变数,其绝对为 0 例子:ABS(-2000) 
结果:2000 
Array (以逗点分隔的数组元素) Array 函数传回数组元素的值。 例子: 
A=Array(1,2,3)
B=A(2)
结果: 2
说明:变量B为A数组的第二个元素的值。  
Asc (字符串) 将字符串的第一字母转换成 ANSI (美国国家标准符号)字码。 例子:Asc(”Internet”)
结果:73
说明:显示第一字母 I 的 ANSI 字码。  
CBool(表达式) 转换成布尔逻辑值变量型态(True 或False ) 例子:CBool(1+2)
结果:True  
CDate (日期表达式) 换成日期变量型态。可先使用 IsDate 函数判断是否可以转换成日 期。 例子: CDate (now( )+2) 
结果:2000/5/28 10:30:59  
CDbl(表达式) 转换成DOUBLE变量型态。  
Chr ( ANSI 字码) 将ASCII 字码转换成字符。 例子: Chr ( 72 )
结果: H  
CInt (表达式) 转换成整数变量型态。 例子: CInt ("3.12") 
结果: 3  
CLng (表达式) 转换成LONG 变量型态。  
CSng (表达式) 转换成SINGLE 变量型态。  
CStr (表达式) 转换成字符串变量型态。  
Date ( )top 传回系统的日期。 例子: Date 
结果: 2000/5/13 
DateAdd ( I , N , D ) 将一个日期加上一段期间后的日期。 I :设定一个日期( Date )所加上的一段期间的单位。譬如 interval="d" 表示 N的单位为日。 I的设定值如下: 
yyyy Year 年 
q Quarter 季 
m Month 月 
d Day 日 
w Weekday 星期 
h Hour 时 
n Minute 分 
s Second 秒 
N :数值表达式,设定一个日期所加上的一段期间,可为正值或负值,正值表示加(结果为 >date 以后的日期),负值表示减(结果为 >date 以前的日期)。 
D :待加减的日期。 例子: DateAdd ( "m" , 1 , "31-Jan-98") 
结果: 28-Feb-98 
说明:将日期 31-Jan-98 加上一个月,结果为 28-Feb-98 而非 31-Fe-98 。 
例子: DateAdd ( "d" , 20 , "30-Jan-99") 
结果: 1999/2/9 
说明:将一个日期 30-Jan-99 加上 20 天后的日期。 
DateDiff (I , D1 , D2[,FW[,FY]]) 计算两个日期之间的期间。 
I :设定两个日期之间的期间计算之单位。譬如 >I="m" 表示计算的单位为月。 >I 的设定值如: 
yyyy > Year 年 
q Quarter 季 
m Month 月 
d Day 日 
w Weekday 星期 
h Hour 时 
m Minute 分 
s Second 秒 
D1 ,D2:计算期间的两个日期表达式,若 >date1 较早,则两个日期之间的期间结果为正值;若 >date2 较早, 则结果为负值。 
FW :设定每周第一天为星期几, 若未设定表示为星期天。 >FW 的设定值如下: 
0 使用 >API 的设定值。 
1 星期天 
2 星期一 
3 星期二 
4 星期三 
5 星期四 
6 星期五 
7 星期六 
FY :设定一年的第一周, 若未设定则表示一月一日那一周为一年的第一周。 >FY 的设定值如下: 
0 使用 >API 的设定值。 
1 一月一日那一周为一年的第一周 
2 至少包括四天的第一周为一年的第一周 
3 包括七天的第一周为一年的第一周 例子: DateDiff ("d","25-Mar-99 ","30-Jun-99 ") 
结果: 97 
说明:显示两个日期之间的期间为 97 天。 
DatePart (I,D,[,FW[,FY]]) 传回一个日期的之部份。 
>I :设定传回那一部份。譬如 >I="d" 表示传回 部份为日。 >I 的设定值如下: 
yyyy Year 年 
q Quarter 季 
m Month 月 
d Day 日 
w Weekday 星期 
h Hour 时 
m Minute 分 
s Second 秒 
D :待计算的日期。 
>FW :设定每周第一天为星期几, 若未设定则表示为星期天。 >FW 的设定值如下: 
0 使用 >API 的设定值。 
1 星期天 
2 星期一>3 星期二 
4 星期三 
5 星期四 
6 星期五 
7 星期六 
FY :设定一年的第一周, 若未设定则表示一月一日那一周为一年的第一周。 >FY 的设定值如下: 
0 使用 >API 的设定值。 
1 一月一日那一周为一年的第一周 
2 至少包括四天的第一周为一年的第一周 
3 包括七天的第一周为一年的第一周 例子: DatePart ("m","25-Mar-99 ") 
结果: 3 
说明:显示传回一个日期 的月部份。 
Dateserial (year,month,day) 转换(year,month,day) 成日期变量型态。 例子: DateSerial (99,10,1) 
结果: 1999/10/1 
Datevalue ( 日期的字符串或表达式 ) 转换成日期变量型态,日期从 January 1,100 到 December 31,9999 。格式为 month,day,and year 或 month/day/year 。譬如: December 30,1999 、 Dec 30,1999 、 12/30/1999 、 12/30/99 例子: Datevalue ("January 1,2002 ") 
结果: 2002/1/1 
Day( 日期的字符串或表达式 ) 传回日期的「日」部份。 例子: Day(" 12/1/1999 ") 
结果: 1 
Fix( 表达式 )top 转换字符串成整数数字型态。与 Int 函数相同。若为 null 时传回 null 。 
Int (number) 与 Fix(number) 的差别在负数。如 Int (-5.6)=-6 , Fix(-5.6)=-5 。 例子: Fix(5.6) 
结果: 5 
Hex( 表达式 )top 传回数值的十六进制值。若表达式为 null 时 Hex( 表达式 )=null ,若表达式 =Empty 时 Hex( 表达式 )=0 。 16 进位可以加「 &H 」表示,譬如 16 进位 &H10 表示十进制的 16 。 例子: Hex(30) 
结果: 1E 
Hour( 时间的字符串或表达式 ) 传回时间的「小时」部份。 例子: Hour("12:30:54 ") 
结果: 12 
InStr ([start,]string1,string2[,compare]) top 将一 个 字符串由左 而右与另一个比较,传回第一个相同的位置。 
start 为从第几个字比较起,若省略 start 则从第一个字比较起, string1 为待寻找的字符串表达式, string2 为 待比较的字符串表达式, compare 为比较的方法, compare=0 表二进制比较法, compare=1 表文字比较法,若省略 compare 则为预设的二进制比较法。 例子: InStr("abc123def123","12") 
结果: 4 
InstrRev ([start,]string1,string2[,compare]) 将一 个 字符串 由右而左与另一个比较,传回第一个相同的位置。 
start 为从第几个字比较起,若省略 start 则从第一个字比较起, string1 为待寻找的字符串表达式, string2 为 待比较的字符串表达式, compare 为比较的方法, compare=0 表二进制比较法, compare=1 表文字比较法,若省略 compare 则为预设的二进制比较法。 例子: InstrRev ("abc123def123","12") 
结果: 10 
Int ( 表达式 ) 传回一个数值的整数部份。与 Fix 函数相同。 例子: Int (5.6) 
结果: 5 
IsArray ( 变数 ) 测试变量是 (True) 否 (False) 是一个数组。 例子: IsArray (3) 
结果: False 
说明:不是一个数组。 
IsDate ( 日期或字符串的表达式 ) 是否可以转换成日期。日, 期从 January 1,100 A.D. 到 December 31,9999 A.D 。 例子: IsDate ("December 31,1999 ") 
结果: True 
说明:可以转换成日期。 
IsEmpty ( 变数 ) 测试变量是 (True) 否 (False) 已经被初始化 例子: IsEmpty (a) 
结果: True 
IsNull ( 变数 ) 测试变数是 (True) 否 (False) 不是有效的数据。 例子: IsNull ("") 
结果: False 
说明:是有效的数据。 
IsNumeric ( 表达式 ) 是 (True) 否 (False) 是数字。 例子: IsNumeric ("abc123") 
结果: False 
说明:不是数字。 
LCase ( 字符串表达式 ) top 转换字符串成小写。将大写字母的部份转换成小写。字符串其余的部份不变。 例子: LCase ("ABC123") 
结果: abc123 
Left( 字符串表达式 ,length) 取字符串左边的几个字。 length 为取个字。 Len 函数可得知字符串的长度。 例子: Left("ABC123",3) 
结果: ABC 
Len( 字符串表达式 变量 ) 取得字符串的长度。 例子: Len("ABC123") 
结果: 6 
LTrim ( 字符串表达式 ) 除去字符串左边的空白字。 RTrim 除去字符串右边的空白字, Trim 函数除去字符串左右两边的空白字。 例子: LTrim ("456+" abc ") 
结果: 456abc123 
Mid( 字符串表达式 ,start[,length]) top 取字符串中的几个字。 start 为从第几个 字取起, length 为取几个字, 若略 length 则从 start 取到最右底。由Len 函数可得知字符串的长度。 例子: Mid("abc123",2,3) 
结果: c12 
Minute( 日期的字符串或表达式 ) 传回时间的「分钟」部份。 例子: Minute("12:30:54") 
结果:30 
Month(日期的字符串或表达式) 传回日期的「月」部份。 例子:Month("12/1/2001") 
结果:12 
MonthName(month[,abbreviate]) 传回月的名称。 
month :待传回月名称的数字 1~12 。譬如, 1 代表一月, 7 代表七月。 
abbreviate: 是 (True) 否 (False) 为缩写,譬如 March ,缩写为 Mar 。默认值为 False 。中文的月名称无缩写。 例子: MonthName (7) 
结果:七月 
Now() 传回系统的日期时间。 例子: Now() 
结果: 2001/12/30 10:35:59 AM 
Oct() 传回数值的八进位值。八进位可以加「 &O 」表示,譬如八进位 &O10 表示十进制的 8 。 例子: Oct(10) 
结果: 12 
Replace( 字符串表达式,findnreplacewith[,start[,count[,compare]]])  将一个字符串取代 部份字。寻找待取代的原字符串 (find) , 若找到则被取代为新字符串 (replacewith) 。 
find :待寻找取代的原字符串。 
replacewith :取代后的字。 
start :从第几个字开始寻找取代, 若未设定则由第一个字开始寻找。 
count :取代的次数。 若未设定则所有寻找到的字符串取代字符 串全部被取代。 
compare :寻找比较的方法, compare=0 表示二进制比较法, compare=1 表文字比较法, compare =2 表根据比较的 数据型态而定,若省略 compare 则为预设的二进制比较法。 例子: Replace("ABCD123ABC","AB","ab") 
结果: abCD123abC 
Right( 字符串表达式 ,length) 取字符串右边的几个字, length 为取几个字。 Len 函数可得知字符串的长度。 例子: Right("ABC123",3) 
结果: 123 
Rnd [(number)] 0~1 的 随机随机数值。 number 是任何有效的数值表达式。若 number 小于 0 表示每次得到相同的 随机随机数值。 number 大于 0 或未提供时表示依序得到下一个 随机随机数值。 >number=0 表示得到最近产生的 随机随机数值。为了避免得到相同的随机随机数顺序,可以于 Rnd 函数前加 Randomize 。 例子: Rnd 
结果: 0.498498 
Round( 数值表达式 [,D]) 四舍五入。 
D :为四舍五入到第几位小数,若省略则四舍五入到整数。 例子: Round(30635,1) 
结果: 3.6 
RTrim ( 字符串表达式 ) 除去字符串右边的空白字。 LTrim 除去字符串左边的空白字, Trim 函数除去字符串左右两边的空白字。 例子: RTrim ("abc123 ")+"456" 
结果: abc123456 
Second( 时间的字符串或表达式 )top 传回时间的「秒」部份。 例子:Second("12:30:54") 
结果:54 
Space( 重复次数 ) 得到重复相同的空白字符串。 例子: A"+Space (5)+"B 
结果: A B 
说明: A 和 B 中间加入五个空白字。 
String( 重复次数,待重复的字 ) 得到重复相同的字符串。 例子: String(5,71) 
结果: GGGGG 
StrReverse (String(10,71)) 将一个字符串顺序颠倒。 例子: StrReverse ("ABC") 
结果: CBA 
Time() 传回系统的时间。 例子: Time 
结果: 10:35:59 PM 
TimeSerial (hour,minute,second) 转换指定的 ( hour,minute,second) 成时间 变量型态。 例子: TimeSerial (10,31,59) 
结果: 10:31:59 
Timevalue ( 日期的字符串或表达式 ) 转换 成时间变量型态。日期的字符串或表达式从 0:00:00(12:00:00 A.M.) 到 23:59:59(11:59:59 P.M.) 。 例子: Timevalue (" 11:59:59 ") 
结果: 11:59:59 
Trim( 字符串表达式 ) 除去字符串左右两边的空白字。 例子: Trim(" abc123 ") 
结果: abc123 
UCase ()top 转换字符串成大写。将小写字母的部份转换成大写,字符串其余部份不变。 例子: UCase ("abc123") 
结果: ABC123 
VarType ( 变数 ) 传回一个变量类型。与 TypeName 函数相同, VarType 传回变量类型的代码, TypeName 传回变量类型的名称。 例子: VarType ( "I love you!") 
结果: 8 
Weekday( 日期表达式 ,[FW])  传回星期几的数字。 
FW :设定一周的第一天是星期几。若 省略则表 1( 星期日 ) 。 
Firstdayfweek 设定值为: 1( 星期日 ),2( 星期一 ),3( 星期二 ),4( 星期三 ),5( 星期四 ),6( 星期五 ),7( 星期六 ) 。 例子: Weekday(" 1/1/2000") 
结果: 7 
WeekDayName (W,A,FW) 传回星期几的名称。 
W :是 (True) 否 (False) 为缩写。譬如 March ,缩写为 Mar 。预设为 False 。中文的星期几名称无缩写。 
FW :设定一周的第一天是星期几。 若省略表 1( 星期日 ) 。设定待传回星期几的名称,为一周中的第几天。 
A : 1( 星期日 ),2( 星期一 ),3( 星期二 ),4( 星期三 ),5( 星期四 ),6( 星期五 ),7( 星期六 ) 。 例子: WeekDayName ("1/1/2000") 
结果:星期六 
Year() 传回日期的「年」部份。 例子: Year(" 12/1/2000 ") 
结果: 2000 

ASP函数详解(1)
http://www.yzcc.com/2005/1-16/09311124554.html
Array()
  FUNCTION: 返回一个数组
  SYNTAX: Array(list)
  ARGUMENTS: 字符,数字均可
  EXAMPLE: <%
  Dim myArray()
  For i = 1 to 7
  Redim Preserve myArray(i)
  myArray(i) = WeekdayName(i)
  Next
  %>
  RESULT: 建立了一个包含7个元素的数组myArray
  myArray("Sunday","Monday", ... ... "Saturday") 


CInt()
  FUNCTION: 将一个表达式转化为数字类型
  SYNTAX: CInt(expression)
  ARGUMENTS: 任何有效的字符均可
  EXAMPLE: <%
  f = "234"
  response.write cINT(f) + 2
  %>
  RESULT: 236
  转化字符"234"为数字"234",如果字符串为空,则返回0值 

CreateObject()
  FUNCTION: 建立和返回一个已注册的ACTIVEX组件的实例。
  SYNTAX: CreateObject(objName)
  ARGUMENTS: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
  EXAMPLE: <%
  Set con = Server.CreateObject("ADODB.Connection")
  %>
  RESULT: 

CStr()
  FUNCTION: 转化一个表达式为字符串.
  SYNTAX: CStr(expression)
  ARGUMENTS: expression 是任何有效的表达式。
  EXAMPLE: <%
  s = 3 + 2
  response.write "The result is: " & cStr(s)
  %>
  RESULT: 转化数字“5”为字符“5”。 

Date()
  FUNCTION: 返回当前系统日期.
  SYNTAX: Date()
  ARGUMENTS: None.
  EXAMPLE: <%=Date%>
  RESULT: 8/4/99 

DateAdd()
  FUNCTION: 返回一个被改变了的日期。
  SYNTAX: DateAdd(timeinterval,number,date)
  ARGUMENTS: timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date.
  EXAMPLE: <%
  currentDate = #8/4/99#
  newDate = DateAdd("m",3,currentDate)
  response.write newDate
  %> 

  <%
  currentDate = #12:34:45 PM#
  newDate = DateAdd("h",3,currentDate)
  response.write newDate
  %>
  RESULT: 11/4/99
  3:34:45 PM 

  "m" = "month";
  "d" = "day"; 

  If currentDate is in time format then,
  "h" = "hour";
  "s" = "second"; 

DateDiff()
  FUNCTION: 返回两个日期之间的差值 。
  SYNTAX: DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
  ARGUMENTS: timeinterval 表示相隔时间的类型,如“M“表示“月”。
  EXAMPLE: <%
  fromDate = #8/4/99#
  toDate = #1/1/2000#
  response.write "There are " & _
  DateDiff("d",fromDate,toDate) & _
  " days to millenium from 8/4/99."
  %>
  RESULT: 从8/4/99 到2000年还有 150 天. 

Day()
  FUNCTION: 返回一个月的第几日 .
  SYNTAX: Day(date)
  ARGUMENTS: date 是任何有效的日期。
  EXAMPLE: <%=Day(#8/4/99#)%>
  RESULT: 4 

FormatCurrency()
  FUNCTION: 返回表达式,此表达式已被格式化为货币值
  SYNTAX: FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置;   LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。
  EXAMPLE: <%=FormatCurrency(34.3456)%>
  RESULT: $34.35 

FormatDateTime()
  FUNCTION: 返回表达式,此表达式已被格式化为日期或时间
  SYNTAX: FormatDateTime(Date, [, NamedFormat])
  ARGUMENTS: NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.
  EXAMPLE: <%=FormatDateTime("08/4/99", vbLongDate)%>
  RESULT: Wednesday, August 04, 1999 

FormatNumber()
  FUNCTION: 返回表达式,此表达式已被格式化为数值.
  SYNTAX: FormatNumber(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; GroupDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。.
  EXAMPLE: <%=FormatNumber(45.324567, 3)%>
  RESULT: 45.325 

FormatPercent()
  FUNCTION: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
  SYNTAX: FormatPercent(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: 同上.
  EXAMPLE: <%=FormatPercent(0.45267, 3)%>
  RESULT: 45.267% 

Hour()
  FUNCTION: 以24时返回小时数.
  SYNTAX: Hour(time)
  ARGUMENTS:
  EXAMPLE: <%=Hour(#4:45:34 PM#)%>
  RESULT: 16
  (Hour has been converted to 24-hour system) 

Instr()
  FUNCTION: 返回字符或字符串在另一个字符串中第一次出现的位置.
  SYNTAX: Instr([start, > strToBeSearched, strSearchFor [, compare>)
  ARGUMENTS: Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符compare 比较方式(详细见ASP常数)
  EXAMPLE: <%
  strText = "This is a test!!"
  pos = Instr(strText, "a")
  response.write pos
  %>
  RESULT: 9 

InstrRev()
  FUNCTION: 同上,只是从字符串的最后一个搜索起
  SYNTAX: InstrRev([start, > strToBeSearched, strSearchFor [, compare])
  ARGUMENTS: 同上.
  EXAMPLE: <%
  strText = "This is a test!!"
  pos = InstrRev(strText, "s")
  response.write pos
  %>
  RESULT: 13 


Int()
  FUNCTION: 返回数值类型,不四舍五入。
  SYNTAX: Int(number)
  ARGUMENTS:
  EXAMPLE: <%=INT(32.89)%>
  RESULT: 32 

IsArray()
  FUNCTION: 判断一对象是否为数组,返回布尔值 .
  SYNTAX: IsArray(name)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "Test!"
  response.write IsArray(strTest)
  %>
  RESULT: False 

IsDate()
  FUNCTION: 判断一对象是否为日期,返回布尔值
  SYNTAX: IsDate(expression)
  ARGUMENTS: expression is any valid expression.
  EXAMPLE: <%
  strTest = "8/4/99"
  response.write IsDate(strTest)
  %>
  RESULT: True 

IsEmpty()
  FUNCTION: 判断一对象是否初始化,返回布尔值.
  SYNTAX: IsEmpty(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Dim i
  response.write IsEmpty(i)
  %>
  RESULT: True 

IsNull()
  FUNCTION: 判断一对象是否为空,返回布尔值.
  SYNTAX: IsNull(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Dim i
  response.write IsNull(i)
  %>
  RESULT: False
  
  IsNumeric()
  FUNCTION: 判断一对象是否为数字,返回布尔值.
  SYNTAX: IsNumeric(expression)
  ARGUMENTS:
  EXAMPLE: <%
  i = "345"
  response.write IsNumeric(i)
  %>
  RESULT: True
  就算数字加了引号,ASP还是认为它是数字。 

IsObject()
  FUNCTION: 判断一对象是否为对象,返回布尔值.
  SYNTAX: IsObject(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Set con = Server.CreateObject("ADODB.Connection")
  response.write IsObject(con)
  %>
  RESULT: True 


LBound()
  FUNCTION: 返回指定数组维的最小可用下标.
  SYNTAX: Lbound(arrayname [, dimension])
  ARGUMENTS: dimension 指明要返回哪一维下界的整数。使用 1 表示第一维,2 表示第二维,以此类  推。如果省略 dimension 参数,默认值为 1.
  EXAMPLE: <%
  i = Array("Monday","Tuesday","Wednesday")
  response.write LBound(i)
  %>
  RESULT: 0 

LCase()
  FUNCTION: 返回字符串的小写形式
  SYNTAX: Lcase(string)
  ARGUMENTS: string is any valid string expression.
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write LCase(strTest)
  %>
  RESULT: this is a test! 

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

Len()
  FUNCTION: 返回字符串的长度.
  SYNTAX: Len(string | varName)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write Len(strTest)
  %>
  RESULT: 15 

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

Mid()
  FUNCTION: 返回特定长度的字符串(从start开始,长度为length).
  SYNTAX: Mid(string, start [, length])
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test! Today is Monday."
  response.write Mid(strTest, 17, 5)
  %>
  RESULT: Today 

Minute()
  FUNCTION: 返回时间的分钟
  SYNTAX: Minute(time)
  ARGUMENTS:
  EXAMPLE: <%=Minute(#12:45:32 PM#)%>
  RESULT: 45 

Month()
  FUNCTION: 返回日期.
  SYNTAX: Month(date)
  ARGUMENTS: date is any valid date expression.
  EXAMPLE: <%=Month(#08/04/99#)%>
  RESULT: 8 

MonthName()
  FUNCTION: Returns a string identifying the specified month.
  SYNTAX: MonthName(month, [, Abb〕)
  ARGUMENTS: 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.
  EXAMPLE: <%=MonthName(Month(#08/04/99#))%>
  RESULT: August 

Now()
  FUNCTION: Returns the current system date and time.
  SYNTAX: Now()
  ARGUMENTS: None
  EXAMPLE: <%=Now%>
  RESULT: 8/4/99 9:30:16 AM 

Replace()
  FUNCTION: Returns a string in which a specified sub-string has been replaced with another substring a specified number of times.
  SYNTAX: Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [, compare]]])
  ARGUMENTS: 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.
  EXAMPLE: <%
  strTest = "This is an apple!"
  response.write Replace(strTest, "apple", "orange")
  %>
  RESULT: This is an orange! 

Right()
  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


有时,我几乎梦见
我也曾以圣者的方式度过了一生,
并再次踏上熟悉的人生旅途。
或许久远之前我曾在傲慢的自恃中逝去,
且在那次逝去中,如此热切地祈求着再赋予我一次机会,如此地……
较清晰的直觉告诉我,死亡并未完全抹去我的一生,
足够的零散残骸仍维持着模糊的记忆。
如今,仿佛再一次的,目标又已在望…… 
 
━※完美世家※━ 
 
 
      
  [╠3W讨论版设计..] 国外黑客用脚本偷银行 ...
[网店系统] 那一晚 5.5亿人在感动
[讯领南京网站建设] 灾民归来:回家经历见闻..
[网页制作与网站..] 企业网站设计原则
[BEING FASHION ..] 每天接吻1分钟 能减1斤...
[移动互联欢迎你~] 【学习贴】网络公司销售...
[网站建设大联盟] 如何选择网页设计公司?
[数码空间] 防止QQ密码被盗的五个技巧 

ID: 04973328  perfect-boy 发表于:2005-11-25 16:01:51  第2楼 
ASP函数详解(1)
http://www.yzcc.com/2005/1-16/09311124554.html
Array()
  FUNCTION: 返回一个数组
  SYNTAX: Array(list)
  ARGUMENTS: 字符,数字均可
  EXAMPLE: <%
  Dim myArray()
  For i = 1 to 7
  Redim Preserve myArray(i)
  myArray(i) = WeekdayName(i)
  Next
  %>
  RESULT: 建立了一个包含7个元素的数组myArray
  myArray("Sunday","Monday", ... ... "Saturday") 

CInt()
  FUNCTION: 将一个表达式转化为数字类型
  SYNTAX: CInt(expression)
  ARGUMENTS: 任何有效的字符均可
  EXAMPLE: <%
  f = "234"
  response.write cINT(f) + 2
  %>
  RESULT: 236
  转化字符"234"为数字"234",如果字符串为空,则返回0值 

CreateObject()
  FUNCTION: 建立和返回一个已注册的ACTIVEX组件的实例。
  SYNTAX: CreateObject(objName)
  ARGUMENTS: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
  EXAMPLE: <%
  Set con = Server.CreateObject("ADODB.Connection")
  %>
  RESULT: 

CStr()
  FUNCTION: 转化一个表达式为字符串.
  SYNTAX: CStr(expression)
  ARGUMENTS: expression 是任何有效的表达式。
  EXAMPLE: <%
  s = 3 + 2
  response.write "The result is: " & cStr(s)
  %>
  RESULT: 转化数字“5”为字符“5”。 

Date()
  FUNCTION: 返回当前系统日期.
  SYNTAX: Date()
  ARGUMENTS: None.
  EXAMPLE: <%=Date%>
  RESULT: 8/4/99 

DateAdd()
  FUNCTION: 返回一个被改变了的日期。
  SYNTAX: DateAdd(timeinterval,number,date)
  ARGUMENTS: timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date.
  EXAMPLE: <%
  currentDate = #8/4/99#
  newDate = DateAdd("m",3,currentDate)
  response.write newDate
  %> 

  <%
  currentDate = #12:34:45 PM#
  newDate = DateAdd("h",3,currentDate)
  response.write newDate
  %>
  RESULT: 11/4/99
  3:34:45 PM 

  "m" = "month";
  "d" = "day"; 

  If currentDate is in time format then,
  "h" = "hour";
  "s" = "second"; 

DateDiff()
  FUNCTION: 返回两个日期之间的差值 。
  SYNTAX: DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
  ARGUMENTS: timeinterval 表示相隔时间的类型,如“M“表示“月”。
  EXAMPLE: <%
  fromDate = #8/4/99#
  toDate = #1/1/2000#
  response.write "There are " & _
  DateDiff("d",fromDate,toDate) & _
  " days to millenium from 8/4/99."
  %>
  RESULT: 从8/4/99 到2000年还有 150 天. 

Day()
  FUNCTION: 返回一个月的第几日 .
  SYNTAX: Day(date)
  ARGUMENTS: date 是任何有效的日期。
  EXAMPLE: <%=Day(#8/4/99#)%>
  RESULT: 4 

FormatCurrency()
  FUNCTION: 返回表达式,此表达式已被格式化为货币值
  SYNTAX: FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置;   LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。
  EXAMPLE: <%=FormatCurrency(34.3456)%>
  RESULT: $34.35 

FormatDateTime()
  FUNCTION: 返回表达式,此表达式已被格式化为日期或时间
  SYNTAX: FormatDateTime(Date, [, NamedFormat])
  ARGUMENTS: NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.
  EXAMPLE: <%=FormatDateTime("08/4/99", vbLongDate)%>
  RESULT: Wednesday, August 04, 1999 

FormatNumber()
  FUNCTION: 返回表达式,此表达式已被格式化为数值.
  SYNTAX: FormatNumber(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; GroupDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。.
  EXAMPLE: <%=FormatNumber(45.324567, 3)%>
  RESULT: 45.325 

FormatPercent()
  FUNCTION: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
  SYNTAX: FormatPercent(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
  ARGUMENTS: 同上.
  EXAMPLE: <%=FormatPercent(0.45267, 3)%>
  RESULT: 45.267% 

Hour()
  FUNCTION: 以24时返回小时数.
  SYNTAX: Hour(time)
  ARGUMENTS:
  EXAMPLE: <%=Hour(#4:45:34 PM#)%>
  RESULT: 16
  (Hour has been converted to 24-hour system) 

Instr()
  FUNCTION: 返回字符或字符串在另一个字符串中第一次出现的位置.
  SYNTAX: Instr([start, > strToBeSearched, strSearchFor [, compare>)
  ARGUMENTS: Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符compare 比较方式(详细见ASP常数)
  EXAMPLE: <%
  strText = "This is a test!!"
  pos = Instr(strText, "a")
  response.write pos
  %>
  RESULT: 9 

InstrRev()
  FUNCTION: 同上,只是从字符串的最后一个搜索起
  SYNTAX: InstrRev([start, > strToBeSearched, strSearchFor [, compare])
  ARGUMENTS: 同上.
  EXAMPLE: <%
  strText = "This is a test!!"
  pos = InstrRev(strText, "s")
  response.write pos
  %>
  RESULT: 13 


Int()
  FUNCTION: 返回数值类型,不四舍五入。
  SYNTAX: Int(number)
  ARGUMENTS:
  EXAMPLE: <%=INT(32.89)%>
  RESULT: 32 

IsArray()
  FUNCTION: 判断一对象是否为数组,返回布尔值 .
  SYNTAX: IsArray(name)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "Test!"
  response.write IsArray(strTest)
  %>
  RESULT: False 

IsDate()
  FUNCTION: 判断一对象是否为日期,返回布尔值
  SYNTAX: IsDate(expression)
  ARGUMENTS: expression is any valid expression.
  EXAMPLE: <%
  strTest = "8/4/99"
  response.write IsDate(strTest)
  %>
  RESULT: True 

IsEmpty()
  FUNCTION: 判断一对象是否初始化,返回布尔值.
  SYNTAX: IsEmpty(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Dim i
  response.write IsEmpty(i)
  %>
  RESULT: True 

IsNull()
  FUNCTION: 判断一对象是否为空,返回布尔值.
  SYNTAX: IsNull(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Dim i
  response.write IsNull(i)
  %>
  RESULT: False
  
  IsNumeric()
  FUNCTION: 判断一对象是否为数字,返回布尔值.
  SYNTAX: IsNumeric(expression)
  ARGUMENTS:
  EXAMPLE: <%
  i = "345"
  response.write IsNumeric(i)
  %>
  RESULT: True
  就算数字加了引号,ASP还是认为它是数字。 

IsObject()
  FUNCTION: 判断一对象是否为对象,返回布尔值.
  SYNTAX: IsObject(expression)
  ARGUMENTS:
  EXAMPLE: <%
  Set con = Server.CreateObject("ADODB.Connection")
  response.write IsObject(con)
  %>
  RESULT: True 


LBound()
  FUNCTION: 返回指定数组维的最小可用下标.
  SYNTAX: Lbound(arrayname [, dimension])
  ARGUMENTS: dimension 指明要返回哪一维下界的整数。使用 1 表示第一维,2 表示第二维,以此类  推。如果省略 dimension 参数,默认值为 1.
  EXAMPLE: <%
  i = Array("Monday","Tuesday","Wednesday")
  response.write LBound(i)
  %>
  RESULT: 0 

LCase()
  FUNCTION: 返回字符串的小写形式
  SYNTAX: Lcase(string)
  ARGUMENTS: string is any valid string expression.
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write LCase(strTest)
  %>
  RESULT: this is a test! 

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

Len()
  FUNCTION: 返回字符串的长度.
  SYNTAX: Len(string | varName)
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test!"
  response.write Len(strTest)
  %>
  RESULT: 15 

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

Mid()
  FUNCTION: 返回特定长度的字符串(从start开始,长度为length).
  SYNTAX: Mid(string, start [, length])
  ARGUMENTS:
  EXAMPLE: <%
  strTest = "This is a test! Today is Monday."
  response.write Mid(strTest, 17, 5)
  %>
  RESULT: Today 

Minute()
  FUNCTION: 返回时间的分钟
  SYNTAX: Minute(time)
  ARGUMENTS:
  EXAMPLE: <%=Minute(#12:45:32 PM#)%>
  RESULT: 45 

Month()
  FUNCTION: 返回日期.
  SYNTAX: Month(date)
  ARGUMENTS: date is any valid date expression.
  EXAMPLE: <%=Month(#08/04/99#)%>
  RESULT: 8 

MonthName()
  FUNCTION: Returns a string identifying the specified month.
  SYNTAX: MonthName(month, [, Abb〕)
  ARGUMENTS: 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.
  EXAMPLE: <%=MonthName(Month(#08/04/99#))%>
  RESULT: August 

Now()
  FUNCTION: Returns the current system date and time.
  SYNTAX: Now()
  ARGUMENTS: None
  EXAMPLE: <%=Now%>
  RESULT: 8/4/99 9:30:16 AM 

Replace()
  FUNCTION: Returns a string in which a specified sub-string has been replaced with another substring a specified number of times.
  SYNTAX: Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [, compare]]])
  ARGUMENTS: 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.
  EXAMPLE: <%
  strTest = "This is an apple!"
  response.write Replace(strTest, "apple", "orange")
  %>
  RESULT: This is an orange! 

Right()
  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

 

相关软件
·用vb写的注册表操作函数
·用取整函数求四舍五入
·ASP功能增强函数
·asp常用函数(2)
·VB常用函数精选
·ASP多功能翻页函数 v2.0


1分 0
2分 0
3分 0
4分 0
5分 0
共有 0 人打分
平均得分:0


按字符查询:ABCDEFGHIJKLMNOPQRSTUVWXYZ0~9中文
下载图示: - 附汉化补丁 - 附注册 - 会员软件 - 推荐 - 最新添加
Rainight, 星旺坡 联网备案号:41092802000212 豫ICP备19032584号-1 页面执行时间: 0.25秒
业务QQ:80571569 手机:13030322310