[轉(zhuǎn)文][原創(chuàng)]ASP常用函數(shù)一覽
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
:ASP常用函數(shù)一覽 asp 常用函數(shù)大全
1.數(shù)值型函數(shù):
abs(num): 返回絕對(duì)值 sgn(num): num>0 1; num=0 0; num<0 -1;判斷數(shù)值正負(fù) hex(num): 返回十六進(jìn)制值 直接表示:&Hxx 最大8位 oct(num): 返回八進(jìn)制值 直接表示:&Oxx 最大8位 sqr(num): 返回平方根 num>0 int(num): 取整 int(99.8)=99; int(-99.2)=100 fix(num): 取整 fix(99.8)=99; fix(-99.2)=99 round(num,n): 四舍五入取小數(shù)位 round(3.14159,3)=3.142 中點(diǎn)數(shù)值四舍五入為近偶取整 round(3.25,1)=3.2 log(num): 取以e為底的對(duì)數(shù) num>0 exp(n): 取e的n次冪 通常用 num^n sin(num): 三角函數(shù),以弧度為值計(jì)算 (角度*Pai)/180=弧度 con(num); tan(num); atn(num) 2.字符串函數(shù):
len(str):計(jì)算字符串長(zhǎng)度 中文字符長(zhǎng)度也計(jì)為一! mid(str,起始字符,[讀取長(zhǎng)度]):截取字符串中間子字符串 left(str,nlen):從左邊起截取nlen長(zhǎng)度子字符串 right(str,nlen):從右邊起截取nlen長(zhǎng)度子字符串 Lcase(str):字符串轉(zhuǎn)成小寫(xiě) Ucase(str):字符串轉(zhuǎn)成大寫(xiě) trim(str):去除字符串兩端空格 Ltrim(str):去除字符串左側(cè)空格 Rtrim(str):去除字符串右側(cè)空格 replace(str,查找字符串,替代字符串,[起始字符,替代次數(shù),比較方法]):替換字符串注:默認(rèn)值:起始字符 1;替代次數(shù) 不限;比較方法 區(qū)分大小寫(xiě)(0)
InStr([起始字符,]str,查找字符串[,比較方法]):檢測(cè)是否包含子字符串可選參數(shù)需同時(shí)選 返回起始位置 InStrRev(str,查找字符串[,起始字符][,比較方法]):反向檢測(cè)是否包含子字符串返回起始位置 space(n):構(gòu)造n個(gè)空格的字符串 string(n,str):構(gòu)造由n個(gè)str第一個(gè)字符組成的字符串 StrReverse(str):反轉(zhuǎn)字符串 split(str,分割字符串[,次數(shù)][,比較方法]):以分割字符串為分割標(biāo)志將字符串轉(zhuǎn)為字符數(shù)組 3.數(shù)據(jù)類(lèi)型轉(zhuǎn)換函數(shù):
Cint(str):轉(zhuǎn)換正數(shù) True -1;False 0;日期 距離1899/12/31天數(shù);時(shí)間上午段 0;下午段 1; Cstr(str):日期 輸出格式 yyyy/mm/dd;時(shí)間 輸出格式 Am/Pm hh:mm:ss Clng(str):與Cin()類(lèi)似 Cbool(num):num不為零 True;反之 False Cdate(str):轉(zhuǎn)換日期格式 0:#Am 12:00:00#;正數(shù)距離1899/12/31天數(shù)的日期;浮點(diǎn)數(shù) 日期+小數(shù)時(shí)間 Cbyte(num):num<255 轉(zhuǎn)換為字節(jié) Csng(str):轉(zhuǎn)換為單精度數(shù)值 Cdbl(str):轉(zhuǎn)換為雙精度數(shù)值 Ccur(str):轉(zhuǎn)換為現(xiàn)金格式 4.時(shí)間函數(shù):
date:取系統(tǒng)當(dāng)前日期 time:取系統(tǒng)當(dāng)前時(shí)間 now:取系統(tǒng)當(dāng)前時(shí)間及日期值 Datetime類(lèi)型 timer:取當(dāng)前時(shí)間距離零點(diǎn)秒值,計(jì)時(shí)器,可計(jì)算時(shí)間差 DateAdd(間隔單位,間隔值,日期):推算相鄰日期 DateDiff(間隔單位,日期一,日期二):計(jì)算時(shí)間差 日期二-日期一 Datepart(間隔單位,日期):計(jì)算日期的間隔單位值 Dateserial(date):輸出日期值(按序列計(jì)算) Timeserial(time):輸出時(shí)間值(按序列計(jì)算) DateValue(datetime):取出字符串中日期值 Timevalue(datetime):取出字符串中時(shí)間值 weekday(date):計(jì)算星期幾 MonthName(date):輸出月分名 year(datetime):截取年份 month(datetime):截取月份 day(datetime):截取日 hour(datetime):截取小時(shí) minute(datetime):截取分鐘 second(datetime):截取秒 5.其它函數(shù):
Array(unit,..):動(dòng)態(tài)生成數(shù)組 Asc(str):輸出字符串第一個(gè)字符的ASCII碼 Chr(asc):轉(zhuǎn)換ASCII為字符 Enter:Chr(13)&Chr(10) Filter(數(shù)組名稱(chēng),關(guān)鍵字符串,[,包含][,比較方法]):將字符串?dāng)?shù)組中含有關(guān)鍵字符串的元素存成新的數(shù)組(默認(rèn)) [包含]為false則取不包 含的元素
Join(ArrayName):將數(shù)組中元素連成字符串 Ubound(ArrayName[,維數(shù)]):取得數(shù)組相應(yīng)維數(shù)的上界 Lbound(ArrayName[,維數(shù)]):取得數(shù)組相應(yīng)維數(shù)的下界 一般為0 Randmize n:?jiǎn)?dòng)隨機(jī)數(shù)種子 Rnd(n):取得隨機(jī)數(shù),n>0或?yàn)榭眨⌒蛄邢乱浑S機(jī)值,n<0,隨機(jī)值相同,n=0,生產(chǎn)與上一隨機(jī)值相同的數(shù)取介于A和B之間的隨機(jī)正數(shù)C,公 式:C=Int((B-A+1)*Rnd+A) 條件(B>A)
ASP六大對(duì)象常用語(yǔ)句示范:
Response:
Response.write StrVar/"String":向網(wǎng)頁(yè)寫(xiě)出參數(shù)值或字符串等同于在Html標(biāo)記中嵌入 Response.End:停止頁(yè)面編譯,并將已經(jīng)編譯內(nèi)容輸出到瀏覽器 Response.Buffer=True|False:頁(yè)面編譯時(shí)是否使用緩存的設(shè)置,一般在頁(yè)面頭部設(shè)置 Response.Flush:強(qiáng)制輸出頁(yè)面已編譯部分內(nèi)容 Response.Clear:將緩沖區(qū)內(nèi)的數(shù)據(jù)清除 Response.Redirect URL:停止頁(yè)面編譯或輸出,轉(zhuǎn)載指定所需頁(yè)面 Response.IsClientConnected:返回True|False,檢測(cè)用戶(hù)是否還處于連接狀態(tài) Response.Charset(CharsetName):設(shè)置頁(yè)面編碼類(lèi)型,即 Response.ContentType [= ContentType ]:設(shè)置頁(yè)面文件類(lèi)型,同上 Response.Expires [= number]:設(shè)置頁(yè)面失效時(shí)間,單位分鐘 Response.ExpiresAbsolute [= [date] [time>:設(shè)置頁(yè)面失效的絕對(duì)時(shí)間 Response.Status = StatusDescription:設(shè)置頁(yè)面狀態(tài)描述 Request:
Request("PassStrName"):讀取網(wǎng)頁(yè)傳遞值,包括表單及以?PassStrName=value&PassStrName_n=value_n形式 Request[.collection|property|method](variable) Request.querystring("PassStrName"):讀取Get方法傳遞的表單值和?PassStrName=value Request.QueryString(Varible)[(Index).Count] Request.form("PassStrName"):讀取Post方法傳遞的純表單域的值 Request.Form(Parameter)[(Index).Count] Request.ServerVaribles(Server Environment Variable):讀取客戶(hù)端系統(tǒng)環(huán)境變量,詳見(jiàn)參考 Request.BinaryRead(Count):讀取指定字節(jié)數(shù)的傳送值 Request.TotalBytes:查詢(xún)體的長(zhǎng)度,以字節(jié)為單位,只讀 注:同名表單如:CheckBox如有多項(xiàng)值,則傳遞數(shù)組. Session:(用戶(hù)全局變量)
Session("SesName")=value:存儲(chǔ)Session變量值,也可讀取該值
Session("SesName")=Empty:判斷Session值是否存在的兩種方法 IsEmpty(Session("SesName"))=True|False:判斷Session值是否存在的兩種方法 Session.TimeOut=num:設(shè)置Session變量的存在時(shí)效,單位分鐘 Session.Abandon:清除所有Session變量值 Session.SessionID:Session變量的ID序列號(hào),只讀 Application:(應(yīng)用程序全局變量)
Application("AppName")=value:存儲(chǔ)Application變量值,也可讀取該值 Application("AppName")=Empty:判斷Application值是否存在的兩種方法 IsEmpty(Application("AppName"))=True|False:判斷Application值是否存在的兩種方法 Application.Lock:Application變量值鎖定,防止同時(shí)更改變量值 Application.UnLock:Application變量值解鎖,允許更改變量值 注:Session與Application變量都可以用來(lái)存儲(chǔ)數(shù)組和系統(tǒng)對(duì)象,引用方法是變量名相當(dāng)于數(shù)組名而已,但不能直接改變其值,需要借助臨時(shí) 數(shù)組修改值后,再賦給Session與Application變量
Server:
Server.MapPath("FileUrl"):映射文件名的服務(wù)器站點(diǎn)絕對(duì)地址,Path=Server.MapPath(./)可以得到虛擬目錄根路徑 Server.HtmlEncode("string"):轉(zhuǎn)換為可以直接顯示帶Html格式的字符串,如:<,>等 Server.URLEncode( "string"):轉(zhuǎn)換為瀏覽器地址編碼 set Var=Server.CreatObject("ObjName"):創(chuàng)建對(duì)象變量 Server.scriptTimeout = NumSeconds:ASP程序頁(yè)面執(zhí)行時(shí)限,以秒為單位 Cookies: 存儲(chǔ)在用戶(hù)本機(jī)的臨時(shí)變量,每個(gè)Cookie的最大字節(jié)4KB,最多可以有300個(gè)Cookie 1.2MB Response.cookies("StrCookieName")=value:存儲(chǔ)Cookie變量值,也可讀取該值 Response.cookies("StrCookieName")="":判斷是否為空 Response.cookies("StrCookieName").Expires=Date:變量有效期,以天為單位,小于當(dāng)前時(shí)間立即失效 Response.Cookies(Cookie[(key).Attribute]):標(biāo)準(zhǔn)語(yǔ)法 ObjectContext 控制ASP的事務(wù)處理
ObjectContext.OnTransactionAbort:由放棄的事務(wù)處理事件激發(fā),在腳本完成處理后發(fā)生 ObjectContext.OnTransactionCommit:由成功的事務(wù)處理事件激發(fā),在腳本完成處理后發(fā)生 ObjectContext.SetAbort:顯式的放棄一次事務(wù)處理 ObjectContext.SetComplete:覆蓋前面任何調(diào)用ObjectContext.SetAbort方法的調(diào)用 ASP常用函數(shù)一覽 Array() FUNCTION: 返回一個(gè)數(shù)組 SYNTAX: Array(list) ARGUMENTS: 字符,數(shù)字均可 EXAMPLE: <% Dim myArray() For i = 1 to 7 Redim Preserve myArray(i) myArray(i) = WeekdayName(i) Next %> RESULT: 建立了一個(gè)包含7個(gè)元素的數(shù)組myArray myArray("Sunday","Monday", ... ... "Saturday") CInt() FUNCTION: 將一個(gè)表達(dá)式轉(zhuǎn)化為數(shù)字類(lèi)型 SYNTAX: CInt(expression) ARGUMENTS: 任何有效的字符均可 EXAMPLE: <% f = "234" response.write cINT(f) + 2 %> RESULT: 236 轉(zhuǎn)化字符"234"為數(shù)字"234",如果字符串為空,則返回0值 createObject() FUNCTION: 建立和返回一個(gè)已注冊(cè)的ACTIVEX組件的實(shí)例。 SYNTAX: createObject(objName) ARGUMENTS: objName 是任何一個(gè)有效、已注冊(cè)的ACTIVEX組件的名字. EXAMPLE: <% Set con = Server.createObject("ADODB.Connection") %> RESULT: CStr() FUNCTION: 轉(zhuǎn)化一個(gè)表達(dá)式為字符串. SYNTAX: CStr(expression) ARGUMENTS: expression 是任何有效的表達(dá)式。 EXAMPLE: <% s = 3 + 2 response.write "The result is: " & cStr(s) %> RESULT: 轉(zhuǎn)化數(shù)字“5”為字符“5”。 Date() FUNCTION: 返回當(dāng)前系統(tǒng)日期. SYNTAX: Date() ARGUMENTS: None. EXAMPLE: <%=Date%> RESULT: 8/4/99 DateAdd() FUNCTION: 返回一個(gè)被改變了的日期。 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: 返回兩個(gè)日期之間的差值 。 SYNTAX: DateDiff(timeinterval,date1,date2 [, firstdayofweek ][, firstweekofyear]]) ARGUMENTS: timeinterval 表示相隔時(shí)間的類(lèi)型,如“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: 返回一個(gè)月的第幾日 . SYNTAX: Day(date) ARGUMENTS: date 是任何有效的日期?!?br style="box-sizing: border-box; outline: 0px; overflow-wrap: break-word;"/> EXAMPLE: <%=Day(#8/4/99#)%> RESULT: 4 FormatCurrency() FUNCTION: 返回表達(dá)式,此表達(dá)式已被格式化為貨幣值 SYNTAX: FormatCurrency(Expression [, Digit ][, LeadingDigit ][, Paren ][, GroupDigit]]]]) ARGUMENTS: Digit 指示小數(shù)點(diǎn)右側(cè)顯示位數(shù)的數(shù)值。默認(rèn)值為 -1,指示使用的是 計(jì)算機(jī)的區(qū)域設(shè)置; LeadingDigit 三態(tài)常數(shù),指示是否顯示小數(shù)值小數(shù)點(diǎn)前面的 零。 EXAMPLE: <%=FormatCurrency(34.3456)%> RESULT: $34.35 FormatDateTime() FUNCTION: 返回表達(dá)式,此表達(dá)式已被格式化為日期或時(shí)間 SYNTAX: FormatDateTime(Date, [, NamedFormat]) ARGUMENTS: NamedFormat 指示所使用的日期/時(shí)間格式的數(shù)值,如果省略,則使用 vbGeneralDate. EXAMPLE: <%=FormatDateTime("08/4/99", vbLongDate)%> RESULT: Wednesday, August 04, 1999 FormatNumber() FUNCTION: 返回表達(dá)式,此表達(dá)式已被格式化為數(shù)值. SYNTAX: FormatNumber(Expression [, Digit ][, LeadingDigit ][, Paren ][, GroupDigit]]]]) ARGUMENTS: Digit 指示小數(shù)點(diǎn)右側(cè)顯示位數(shù)的數(shù)值。默認(rèn)值為 -1,指示使用的是 計(jì)算機(jī)的區(qū)域設(shè)置。; LeadingDigit i指示小數(shù)點(diǎn)右側(cè)顯示位數(shù)的數(shù)值。默認(rèn)值為 - 1,指示使用的是計(jì)算機(jī)的區(qū)域設(shè)置。; Paren 指示小數(shù)點(diǎn)右側(cè)顯示位數(shù)的數(shù)值。默認(rèn) 值為 -1,指示使用的是計(jì)算機(jī)的區(qū)域設(shè)置。; GroupDigit i指示小數(shù)點(diǎn)右側(cè)顯示位數(shù) 的數(shù)值。默認(rèn)值為 -1,指示使用的是計(jì)算機(jī)的區(qū)域設(shè)置。. EXAMPLE: <%=FormatNumber(45.324567, 3)%> RESULT: 45.325 FormatPercent() FUNCTION: 返回表達(dá)式,此表達(dá)式已被格式化為尾隨有 % 符號(hào)的百分比(乘以 100 )。 (%) SYNTAX: FormatPercent(Expression [, Digit ][, LeadingDigit ][, Paren ][, GroupDigit]]]]) ARGUMENTS: 同上. EXAMPLE: <%=FormatPercent(0.45267, 3)%> RESULT: 45.267% Hour() FUNCTION: 以24時(shí)返回小時(shí)數(shù). SYNTAX: Hour(time) ARGUMENTS: EXAMPLE: <%=Hour(#4:45:34 PM#)%> RESULT: 16 (Hour has been converted to 24-hour system) Instr() FUNCTION: 返回字符或字符串在另一個(gè)字符串中第一次出現(xiàn)的位置. SYNTAX: Instr([start, ] strToBeSearched, strSearchFor [, compare]) ARGUMENTS: Start為搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符.compare比較方式(詳細(xì)見(jiàn)ASP常數(shù)) EXAMPLE: <% strText = "This is a test!!" pos = Instr(strText, "a") response.write pos %> RESULT: 9 InstrRev() FUNCTION: 同上,只是從字符串的最后一個(gè)搜索起 SYNTAX: InstrRev([start, ] strToBeSearched, strSearchFor [, compare]) ARGUMENTS: 同上. EXAMPLE: <% strText = "This is a test!!" pos = InstrRev(strText, "s") response.write pos %> RESULT: 13 Int() FUNCTION: 返回?cái)?shù)值類(lèi)型,不四舍五入,注意取值是不大于它的整數(shù)。 SYNTAX: Int(number) ARGUMENTS: EXAMPLE: <%=INT(32.89)%> <%=int(-3.33)%> RESULT: 32 -4 IsArray() FUNCTION: 判斷一對(duì)象是否為數(shù)組,返回布爾值 . SYNTAX: IsArray(name) ARGUMENTS: EXAMPLE: <% strTest = "Test!" response.write IsArray(strTest) %> RESULT: False IsDate() FUNCTION: 判斷一對(duì)象是否為日期,返回布爾值 SYNTAX: IsDate(expression) ARGUMENTS: expression is any valid expression. EXAMPLE: <% strTest = "8/4/99" response.write IsDate(strTest) %> RESULT: True IsEmpty() FUNCTION: 判斷一對(duì)象是否初始化,返回布爾值. SYNTAX: IsEmpty(expression) ARGUMENTS: EXAMPLE: <% Dim i response.write IsEmpty(i) %> RESULT: True IsNull() FUNCTION: 判斷一對(duì)象是否為空,返回布爾值. SYNTAX: IsNull(expression) ARGUMENTS: EXAMPLE: <% Dim i response.write IsNull(i) %> RESULT: False IsNumeric() FUNCTION: 判斷一對(duì)象是否為數(shù)字,返回布爾值. SYNTAX: IsNumeric(expression) ARGUMENTS: EXAMPLE: <% i = "345" response.write IsNumeric(i) %> RESULT: True 就算數(shù)字加了引號(hào),ASP還是認(rèn)為它是數(shù)字。 IsObject() FUNCTION: 判斷一對(duì)象是否為對(duì)象,返回布爾值. SYNTAX: IsObject(expression) ARGUMENTS: EXAMPLE: <% Set con = Server.createObject("ADODB.Connection") response.write IsObject(con) %> RESULT: True LBound() FUNCTION: 返回指定數(shù)組維的最小可用下標(biāo). SYNTAX: Lbound(arrayname [, dimension]) ARGUMENTS: ; dimension 指明要返回哪一維下界的整數(shù)。使用 1 表示第一維,2 表示第二維,以此類(lèi)推。如果省略 dimension 參數(shù),默認(rèn)值為 1. EXAMPLE: <% i = Array("Monday","Tuesday","Wednesday") response.write LBound(i) %> RESULT: 0 LCase() FUNCTION: 返回字符串的小寫(xiě)形式 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個(gè)字符以前的字符(含第length個(gè)字符). SYNTAX: Left(string, length) ARGUMENTS: EXAMPLE: <% strTest = "This is a test!" response.write Left(strTest, 3) %> RESULT: Thi Len() FUNCTION: 返回字符串的長(zhǎng)度. 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: 返回特定長(zhǎng)度的字符串(從start開(kāi)始,長(zhǎng)度為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: 返回時(shí)間的分釧. 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個(gè)字符以前的字符(含第length個(gè)字符). SYNTAX: Right(string, length) ARGUMENTS: . EXAMPLE: <% strTest = "This is an test!" response.write Right(strTest, 3) %> RESULT: st! Rnd() FUNCTION: 產(chǎn)生一個(gè)隨機(jī)數(shù). SYNTAX: Rnd [ (number) ] ARGUMENTS: EXAMPLE: <% Randomize() response.write RND() %> RESULT: 任何一個(gè)在0 到 1 之間的數(shù) Round() FUNCTION: 返回按指定位數(shù)進(jìn)行四舍五入的數(shù)值. SYNTAX: Round(expression [, numRight]) ARGUMENTS: numRight數(shù)字表明小數(shù)點(diǎn)右邊有多少位進(jìn)行四舍五入。如果省略,則 Round 函數(shù)返回整數(shù). 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 SPLIT(str,"分隔符")
<% dim str,xxx,xx str="aaaa,bbbb,cccc"
xxx=split(str,",")
for each xx in xxx
response.write(xx&"<br>") next %> aaaa bbbb cccc Time() FUNCTION: 返回系統(tǒng)時(shí)間. 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: 返回指定數(shù)組維數(shù)的最大可用下標(biāo). SYNTAX: Ubound(arrayname [, dimension]) ARGUMENTS: ; dimension (optional) 指定返回哪一維上界的整數(shù)。1 表示第一 維,2 表示第二維,以此類(lèi)推。如果省略 dimension 參數(shù),則默認(rèn)值為 1. EXAMPLE: <% i = Array("Monday","Tuesday","Wednesday") response.write UBound(i) %> RESULT: 2 UCase() FUNCTION: 返回字符串的大寫(xiě)形式. SYNTAX: UCase(string) ARGUMENTS: EXAMPLE: <% strTest = "This is a test!!" response.write UCase(strTest) %> RESULT: THIS IS A TEST!! VarType() FUNCTION: 返回指示變量子類(lèi)型的值 SYNTAX: VarType(varName) ARGUMENTS: EXAMPLE: <% i = 3 response.write varType(i) %> RESULT: 2(數(shù)字)詳見(jiàn)"asp常數(shù)" 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 值,指明是否縮寫(xiě)表示星期各天的名稱(chēng)。如果省 略, 默認(rèn)值為 False,即不縮寫(xiě)星期各天的名稱(chēng).firstdayofweek指明星期第一天的 數(shù)值 EXAMPLE: <% d = #8/4/99# response.write WeekdayName(Weekday(d)) %> RESULT: Wednesday Year() FUNCTION: 返回當(dāng)前的年份. SYNTAX: Year(date) ARGUMENTS: EXAMPLE: <%=Year(#8/4/99#)%> RESULT: 1999 該文章在 2023/11/27 16:19:36 編輯過(guò) |
關(guān)鍵字查詢(xún)
相關(guān)文章
正在查詢(xún)... |