1、response.write cINT(f) + 2 236转化字符为数字,如果字符串为空,则返回0值CreateObject() 建立和返回一个已注册的ACTIVEX组件的实例。 CreateObject(objName) objName 是任何一个有效、已注册的ACTIVEX组件的名字.Set con = Server.CreateObject(ADODB.ConnectionCStr() 转化一个表达式为字符串. CStr(expression) expression 是任何有效的表达式。s = 3 + 2response.write The result is: & cStr(s) 转
2、化数字“5”为字符“5”。Date() 返回当前系统日期. Date() None.%=Date%/IMG 8/4/99DateAdd() 返回一个被改变了的日期。 DateAdd(timeinterval,number,date) timeinterval is the time interval to add; number is amount of time intervals to add; and date is the starting date.currentDate = #8/4/99#newDate = DateAdd(m,3,currentDate)response.wri
3、te newDatecurrentDate = #12:34:45 PM#h 11/4/993:45 PM = month;ddayIf currentDate is in time format then,hourssecondDateDiff() 返回两个日期之间的差值 。 DateDiff(timeinterval,date1,date2 , firstdayofweek , firstweekofyear/IMG/IMG) timeinterval 表示相隔时间的类型,如“M“表示“月”。fromDate = #8/4/99#toDate = #1/1/2000#There are _
4、DateDiff(,fromDate,toDate) & days to millenium from 8/4/99. 从8/4/99 到2000年还有 150 天.Day() 返回一个月的第几日 . Day(date) date 是任何有效的日期。%=Day(#8/4/99#)%/IMG 4FormatCurrency() 返回表达式,此表达式已被格式化为货币值 FormatCurrency(Expression , Digit , LeadingDigit , Paren , GroupDigit/IMG/IMG/IMG/IMG) Digit 指示小数点右侧显示位数的数值。默认值为 -1,
5、指示使用的是计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。%=FormatCurrency(34.3456)%/IMG $34.35FormatDateTime() 返回表达式,此表达式已被格式化为日期或时间 FormatDateTime(Date, , NamedFormat/IMG) NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.%=FormatDateTime(08/4/99, vbLongDate)%/IMG Wednesday, August 04, 1999FormatNumber
6、() 返回表达式,此表达式已被格式化为数值. FormatNumber(Expression , Digit , LeadingDigit , Paren , GroupDigit/IMG/IMG/IMG/IMG)默认值为 -1,指示使用的是计算机的区域设置。 LeadingDigit i指示小数点右侧显示位数的数值。 Paren 指示小数点右侧显示位数的数值。 GroupDigit i指示小数点右侧显示位数的数值。.%=FormatNumber(45.324567, 3)%/IMG 45.325FormatPercent() 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 1
7、00 )。 (%) FormatPercent(Expression , Digit , LeadingDigit , Paren , GroupDigit/IMG/IMG/IMG/IMG) 同上.%=FormatPercent(0.45267, 3)%/IMG 45.267%Hour() 以24时返回小时数. Hour(time)%=Hour(#4:45:34 PM#)%/IMG 16(Hour has been converted to 24-hour system)Instr() 返回字符或字符串在另一个字符串中第一次出现的位置. Instr(start, /IMG strToBeSea
8、rched, strSearchFor , compare/IMG) Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符compare 比较方式(详细见ASP常数)strText = This is a test!pos = Instr(strText, aresponse.write pos 9InstrRev() 同上,只是从字符串的最后一个搜索起 InstrRev(start, /IMG strToBeSearched, strSearchFor , compare/IMG)pos = InstrRev(strText, 13I
9、nt() 返回数值类型,不四舍五入。 Int(number)%=INT(32.89)%/IMG 32IsArray() 判断一对象是否为数组,返回布尔值 . IsArray(name)strTest = Test!response.write IsArray(strTest) FalseIsDate() 判断一对象是否为日期,返回布尔值 IsDate(expression) expression is any valid expression.8/4/99response.write IsDate(strTest) TrueIsEmpty() 判断一对象是否初始化,返回布尔值. IsEmpty
10、(expression)Dim iresponse.write IsEmpty(i)IsNull() 判断一对象是否为空,返回布尔值. IsNull(expression)response.write IsNull(i)IsNumeric() 判断一对象是否为数字,返回布尔值. IsNumeric(expression)i = 345response.write IsNumeric(i)就算数字加了引号,ASP还是认为它是数字。IsObject() 判断一对象是否为对象,返回布尔值. IsObject(expression)response.write IsObject(con)LBound(
11、) 返回指定数组维的最小可用下标. Lbound(arrayname , dimension/IMG) dimension 指明要返回哪一维下界的整数。使用 1 表示第一维,2 表示第二维,以此类推。如果省略 dimension 参数,默认值为 1.i = Array(TuesdayWednesdayresponse.write LBound(i) 0LCase() 返回字符串的小写形式 Lcase(string) string is any valid string expression.response.write LCase(strTest) this is a test!Left()
12、返回字符串左边第length个字符以前的字符(含第length个字符). Left(string, length)response.write Left(strTest, 3) ThiLen() 返回字符串的长度. Len(string | varName)response.write Len(strTest) 15LTrim() 去掉字符串左边的空格. LTrim(string) This is a test!response.write LTrim(strTest)Mid() 返回特定长度的字符串(从start开始,长度为length). Mid(string, start , lengt
13、h/IMG) Today is Monday.response.write Mid(strTest, 17, 5) TodayMinute() 返回时间的分钏. Minute(time)%=Minute(#12:32 PM#)%/IMG 45Month() 返回日期. Month(date) date is any valid date expression.%=Month(#08/04/99#)%/IMG 8MonthName() Returns a string identifying the specified month. MonthName(month, , Abb/IMG) mon
14、th 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.%=MonthName(Month(#08/04/99#)%/IMG AugustNow() Returns the current system date and
15、 time. Now() None%=Now%/IMG 8/4/99 9:30:16 AMReplace() 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/IMG/IMG/IMG) strToBeSearched is a string expre
16、ssion 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 indica
17、ting the comparision constant.This is an apple!response.write Replace(strTest, apple, orange This is an orange!Right() 返回字符串右边第length个字符以前的字符(含第length个字符). Right(string, length) .This is an test!response.write Right(strTest, 3) st!Rnd() 产生一个随机数. Rnd (number) /IMGRandomize()response.write RND() 任何一个在
18、0 到 1 之间的数Round() 返回按指定位数进行四舍五入的数值. Round(expression , numRight/IMG) numRight数字表明小数点右边有多少位进行四舍五入。如果省略,则 Round 函数返回整数.i = 32.45678response.write Round(i)Rtrim() 去掉字符串右边的字符串. Rtrim(string)response.write RTrim(strTest)Second() 返回秒. Second(time)%=Second(#12:28 PM#)%/IMG 28StrReverse() 反排一字符串 StrReverse(string)response.write StrReverse(strTest) !tset a si sihTTime() 返回系统时间. Time()%=Time%/IMG 9:58:28 AMTrim() 去掉字符串左右的空格. Trim(string) This is a t
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1