asp 類型轉(zhuǎn)換函數(shù)大全第2/2頁
更新時(shí)間:2008年10月20日 23:01:33 作者:
asp 類型轉(zhuǎn)換的實(shí)現(xiàn)函數(shù)
IsObject()
函數(shù)判斷一對(duì)象是否為對(duì)象, | 布爾值.
表達(dá)式 IsObject(expression)
實(shí)例: <%
Set con = Server.CreateObject("ADODB.Connection")
response.write IsObject(con)
%>
| 結(jié)果: True
Lbound()
函數(shù) | 指定數(shù)組維的最小可用下標(biāo).
表達(dá)式 Lbound(arrayname [, dimension])
實(shí)例: <%
I = Array("Monday","Tuesday","Wednesday")
response.write Lbound(I)
%>
| 結(jié)果: 0
Lcase()
函數(shù) | 字符串的小寫形式
表達(dá)式 Lcase(string)
實(shí)例: <%
strTest = "This is a test!"
response.write Lcase(strTest)
%>
| 結(jié)果: this is a test!
Left()
函數(shù) | 字符串左邊第length個(gè)字符以前的字符(含第length個(gè)字符).
表達(dá)式 Left(string, length)
實(shí)例: <%
strTest = "This is a test!"
response.write Left(strTest, 3)
%>
| 結(jié)果: Thi
Len()
函數(shù) | 字符串的長(zhǎng)度.
表達(dá)式 Len(string | varName)
實(shí)例: <%
strTest = "This is a test!"
response.write Len(strTest)
%>
| 結(jié)果: 15
Ltrim()
函數(shù)去掉字符串左邊的空格.
表達(dá)式 Ltrim(string)
實(shí)例: <%
strTest = " This is a test!"
response.write Ltrim(strTest)
%>
| 結(jié)果: This is a test!
Mid()
函數(shù) | 特定長(zhǎng)度的字符串(從start開始,長(zhǎng)度為length).
表達(dá)式 Mid(string, start [, length])
實(shí)例: <%
strTest = "This is a test! Today is Monday."
response.write Mid(strTest, 17, 5)
%>
| 結(jié)果: Today
Minute()
函數(shù) | 時(shí)間的分鐘.
表達(dá)式 Minute(time)
實(shí)例: <%=Minute(#12:45:32 PM#)%>
| 結(jié)果: 45
Month()
函數(shù) | 日期.
表達(dá)式 Month(date)
實(shí)例: <%=Month(#08/04/99#)%>
| 結(jié)果: 8
MonthName()
函數(shù) | 指定月份
表達(dá)式 MonthName(month, [, Abb])
實(shí)例: <%=MonthName(Month(#08/04/99#))%>
| 結(jié)果: August
Now()
函數(shù) | 系統(tǒng)時(shí)間
表達(dá)式 Now()
實(shí)例: <%=Now%>
| 結(jié)果: 9/9/00 9:30:16 AM
Right()
函數(shù) | 字符串右邊第length個(gè)字符以前的字符(含第length個(gè)字符).
表達(dá)式 Right(string, length)
實(shí)例: <%
strTest = "This is an test!"
response.write Right(strTest, 3)
%>
| 結(jié)果: st!
Rnd()
函數(shù)產(chǎn)生一個(gè)隨機(jī)數(shù).
表達(dá)式 Rnd [ (number) ]
實(shí)例: <%
Randomize()
response.write RND()
%>
| 結(jié)果: 任何一個(gè)在0 到 1 之間的數(shù)
等待 發(fā)表于 2008-2-25 17:08
instr 查找 索引 函數(shù)
instr 函數(shù)
表達(dá)式:
InStr([start, ]string1, string2[, compare])
描述:
start
可選參數(shù)。為數(shù)值表達(dá)式,設(shè)置每次搜索的起點(diǎn)。如果省略,將從第一個(gè)字符的位置開始。如果 start 包含 Null,將發(fā)生錯(cuò)誤。如果指定了 compare 參數(shù),則一定要有 start 參數(shù)。
string1
必要參數(shù)。接受搜索的字符串表達(dá)式。
string2
必要參數(shù)。被搜索的字符串表達(dá)式。
Compare
可選參數(shù)。指定字符串比較。如果 compare 是 Null,將發(fā)生錯(cuò)誤。如果省略 compare,Option Compare 的設(shè)置將決定比較的類型。
compare 參數(shù)設(shè)置為:
常數(shù)
值
描述
vbUseCompareOption
-1
使用Option Compare 語句設(shè)置執(zhí)行一個(gè)比較。
vbBinaryCompare
0
執(zhí)行一個(gè)二進(jìn)制比較。
vbTextCompare
1
執(zhí)行一個(gè)按照原文的比較。
vbDatabaseCompare
2
僅適用于Microsoft Access,執(zhí)行一個(gè)基于數(shù)據(jù)庫中信息的比較。
返回值
返回0、1、2、-1或Null等。
異常/錯(cuò)誤
無
描述InStr([start, ]string1, string2[, compare])
返回指定一字符串在另一字符串中最先出現(xiàn)的位置。在字符串string1中,從start開始找string2,省略start時(shí)從string1頭開始找。找不到時(shí),函數(shù)值為0。
如果
InStr返回
string1 為零長(zhǎng)度
0
string1 為 Null
Null
string2 為零長(zhǎng)度
Start
string2 為 Null
Null
string2 找不到
0
在 string1 中找到string2
找到的位置
start > string2
0
示例
本示例使用 InStr 函數(shù)來查找某字符串在另一個(gè)字符串中首次出現(xiàn)的位置。
Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP" ' 被搜索的字符串。
SearchChar = "P" ' 要查找字符串 "P"。
' 從第四個(gè)字符開始,以文本比較的方式找起。返回值為 6(小寫 p)。
' 小寫 p 和大寫 P 在文本比較下是一樣的。
MyPos = Instr(4, SearchString, SearchChar, 1)
' 從第一個(gè)字符開使,以二進(jìn)制比較的方式找起。返回值為 9(大寫 P)。
' 小寫 p 和大寫 P 在二進(jìn)制比較下是不一樣的。
MyPos = Instr(1, SearchString, SearchChar, 0)
' 缺省的比對(duì)方式為二進(jìn)制比較(最后一個(gè)參數(shù)可省略)。
MyPos = Instr(SearchString, SearchChar) ' 返回 9。
MyPos = Instr(1, SearchString, "W") ' 返回 0。
相關(guān)文章
微信開發(fā) 網(wǎng)頁授權(quán)獲取用戶基本信息
這篇文章主要介紹了微信開發(fā) 網(wǎng)頁授權(quán)獲取用戶基本信息的相關(guān)資料,需要的朋友可以參考下2016-09-09ASP 微信公共平臺(tái)接口實(shí)現(xiàn)代碼
bluedidea看到的ASP 微信公共平臺(tái)接口實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-01-01服務(wù)端 VBScript 與 JScript 幾個(gè)相同特性的寫法與示例
服務(wù)端 VBScript 與 JScript 幾個(gè)相同特性的寫法與示例...2007-03-03asp實(shí)現(xiàn)excel中的數(shù)據(jù)導(dǎo)入數(shù)據(jù)庫
本文給大家匯總介紹了使用asp實(shí)現(xiàn)將Excel中數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫中的方法,需要的朋友可以參考一下2015-09-09從一個(gè)網(wǎng)站扒下的asp生成靜態(tài)頁面的代碼 腳本之家特供版
雖然腳本之家以前發(fā)布過相關(guān)的代碼,但一些特別的網(wǎng)站不是很完美,最近幫客戶修改系統(tǒng)發(fā)現(xiàn)了這段代碼,發(fā)現(xiàn)還不錯(cuò),特提取出來,方便大家使用。2011-07-07asp下檢查表中是否存在某個(gè)字段(列)函數(shù)
asp可以方便的檢查數(shù)據(jù)庫表中,是否存在這個(gè)字段2008-03-03