VBS基礎(chǔ)篇 - vbscript常用函數(shù)及功能
vbs常用函數(shù)
函數(shù)名 | 語(yǔ)法 | 功能 |
Abs | Abs(number) | 返回一個(gè)數(shù)的絕對(duì)值 |
Sqr | Sqr(number) | 返回一個(gè)數(shù)的平方根 |
Sin | Sin(number) | 返回角度的正玄值 |
Cos | Cos(number) | 返回角度的余玄值 |
Tan | Tan(number) | 返回角度的正切值 |
Atn | Atn(number) | 返回角度的反正切值 |
Log | Log(number) | 返回一個(gè)數(shù)的自然對(duì)數(shù) |
Int | Int(number) | 取整函數(shù),返回一個(gè)小于number的第一整數(shù) |
FormatNumber | FormatNumber(number, numdigitsafterdecimal) | 轉(zhuǎn)化為指定小數(shù)位數(shù)(numdigitsafterdecimal)的數(shù)字 |
Rnd | Rnd() | 返回一個(gè)從0到1的隨機(jī)數(shù) |
Ubound | Ubound(數(shù)組名,維數(shù)) | 返回該數(shù)組的最大下標(biāo) |
Lbound | Lbound(數(shù)組名,維數(shù)) | 返回最小下標(biāo)數(shù) |
注釋?zhuān)?/p>
Rnd 函數(shù)
語(yǔ)法:Rnd[(number)]
返回一隨機(jī)數(shù)。參數(shù) number 可以是任何的數(shù)值表達(dá)式。
注解:
Rnd 函數(shù)返回的隨機(jī)數(shù)介于 0 和 1 之間,可等于 0,但不等于 1。
number 的值會(huì)影響 Rnd 返回的隨機(jī)數(shù):
Number的取值 | 返回值 |
小于0 | 每次都是使用numbe當(dāng)做隨機(jī)結(jié)果。 |
大于0 | 隨機(jī)序列中的下一個(gè)隨機(jī)數(shù)。 |
等于0 | 最近一次產(chǎn)生過(guò)的隨機(jī)數(shù)。 |
省略 | 隨機(jī)序列中的下一個(gè)隨機(jī)數(shù)。 |
各種轉(zhuǎn)換函數(shù)及功能
函數(shù) | 功能 |
CStr(variant) | 將變量variant轉(zhuǎn)化為字符串類(lèi)型 |
CDate(variant) | 將變量variant轉(zhuǎn)化為日期類(lèi)型 |
CInt(variant) | 將變量variant轉(zhuǎn)化為整數(shù)類(lèi)型 |
CLng(variant) | 將變量variant轉(zhuǎn)化為長(zhǎng)整數(shù)類(lèi)型 |
CSng(variant) | 將變量variant轉(zhuǎn)化為single類(lèi)型 |
CDbl(variant) | 將變量variant轉(zhuǎn)化為double類(lèi)型 |
CBool(variant) | 將變量variant轉(zhuǎn)化為布爾類(lèi)型 |
注釋?zhuān)?/p>
1整型
以Integer 表示整型,其范圍為 -32,768 到 32,767 之間。
2、長(zhǎng)整型
Long(長(zhǎng)整型) ,其范圍從 -2,147,483,648 到 2,147,483,647。
3、單精度型(Single)
Single(單精度浮點(diǎn)型),它的范圍在負(fù)數(shù)的時(shí)候是從 -3.402823E38 到 -1.401298E-45,而在正數(shù)的時(shí)候是從 1.401298E-45 到 3.402823E38。
4、雙精度型(Double)
Double(雙精度浮點(diǎn)型)它的范圍在負(fù)數(shù)的時(shí)候是從 -1.79769313486232E308 到 -4.94065645841247E-324,而正數(shù)的時(shí)候是從 4.94065645841247E-324 到 1.79769313486232E308。
常用的字符串函數(shù)及功能
函數(shù) | 語(yǔ)法 | 功能 |
Len | Len(string) | 返回string字符串里的字符數(shù)目 |
Trim | Trim(string) | 將字符串前后的空格去掉 |
Ltrim | Ltrim(string) | 將字符串前面的空格去掉 |
Rtrim | Rtrim(string) | 將字符串后面的空格去掉 |
Mid | Mid(string,start,length) | 從string字符串的start字符開(kāi)始取得length長(zhǎng)度的字符串,如果省略第三個(gè)參數(shù)表示從start字符開(kāi)始到字符串結(jié)尾的字符串 |
Left | Left(string,length) | 從string字符串的左邊取length長(zhǎng)度的字符串 |
Right | Right(string,length) | 從srting字符串的右邊取得length長(zhǎng)度的字符串 |
LCase | LCase(string) | 將字符串里的所有大寫(xiě)字母轉(zhuǎn)化成小寫(xiě)字母 |
UCase | UCase(string) | 將字符串里的小寫(xiě)字母轉(zhuǎn)化成大寫(xiě)字母 |
StrComp | Strcomp(string1,string1) | 返回string1字符串與string2字符串的比較結(jié)果,如果兩個(gè)字符串相同,返回0 |
InStr | InStr(string1,string2) | 返回string2字符串在string1字符串中第一次出現(xiàn)的位置 |
Split | Split(string1,delimiter | 將字符串根據(jù)delimiter拆分成一維數(shù)組,其中delimiter用于表示子字符串界限的字符,如果省略,使用空格(“”)當(dāng)作分隔符 |
Replace | Replace(string1,find,replacewith) | 返回字符串,其中指定的子字符串(find)被替換為另一個(gè)子字符串(replacewith) |
常用的字符串函數(shù)及功能
函數(shù) | 語(yǔ)法 | 功能 |
Len | Len(string) | 返回string字符串里的字符數(shù)目 |
Trim | Trim(string) | 將字符串前后的空格去掉 |
Ltrim | Ltrim(string) | 將字符串前面的空格去掉 |
Rtrim | Rtrim(string) | 將字符串后面的空格去掉 |
Mid | Mid(string,start,length) | 從string字符串的start字符開(kāi)始取得length長(zhǎng)度的字符串,如果省略第三個(gè)參數(shù)表示從start字符開(kāi)始到字符串結(jié)尾的字符串 |
Left | Left(string,length) | 從string字符串的左邊取length長(zhǎng)度的字符串 |
Right | Right(string,length) | 從srting字符串的右邊取得length長(zhǎng)度的字符串 |
LCase | LCase(string) | 將字符串里的所有大寫(xiě)字母轉(zhuǎn)化成小寫(xiě)字母 |
UCase | UCase(string) | 將字符串里的小寫(xiě)字母轉(zhuǎn)化成大寫(xiě)字母 |
StrComp | Strcomp(string1,string1) | 返回string1字符串與string2字符串的比較結(jié)果,如果兩個(gè)字符串相同,返回0 |
InStr | InStr(string1,string2) | 返回string2字符串在string1字符串中第一次出現(xiàn)的位置 |
Split | Split(string1,delimiter | 將字符串根據(jù)delimiter拆分成一維數(shù)組,其中delimiter用于表示子字符串界限的字符,如果省略,使用空格(“”)當(dāng)作分隔符 |
Replace | Replace(string1,find,replacewith) | 返回字符串,其中指定的子字符串(find)被替換為另一個(gè)子字符串(replacewith) |
常用日期和時(shí)間函數(shù)及說(shuō)明
函數(shù) | 語(yǔ)法 | 功能 |
Now | Now() | 取得系統(tǒng)當(dāng)前的日期和時(shí)間 |
Date | Date() | 取得系統(tǒng)當(dāng)前的日期 |
Time | Time() | 取得系統(tǒng)當(dāng)前的時(shí)間 |
Year | Year() | 取得給定日期的年份 |
Month | Month(Date) | 取得給定日期的月份 |
Day | Day(Date) | 取得給定日期是幾號(hào) |
Hour | Hour(time) | 取得給定時(shí)間是第幾小時(shí) |
Minute | Minute(time) | 取得給定時(shí)間是第幾分鐘 |
Second | Second(time) | 取得給定時(shí)間是第幾秒 |
WeekDay | WeekDay(Date) | 取得給定日期是星期幾的整數(shù) 1 表示星期一 2 表示星期二 依次類(lèi)推 |
DateDiff | DateDiff(“Var”, Var1,Var2) Var:日期或時(shí)間間隔因子 Var1:第一個(gè)日期或時(shí)間 Var2:第二個(gè)日期或時(shí)間 |
計(jì)算兩個(gè)日期或時(shí)間的間隔 |
DateAdd | DateAdd(“Var”, Var1,Var2) Var:日期或時(shí)間間隔因子 Var1:日期或時(shí)間 Var2:日期或時(shí)間 |
對(duì)兩個(gè)日期或時(shí)間作加法 DateAdd(“d”,10,Date()) 10天后是幾號(hào) |
FormatDateTime | FortDateTime(Date,vbShortDate) | 轉(zhuǎn)化為短日期格式 |
FortDateTime(Date,vblongDate) | 轉(zhuǎn)化為長(zhǎng)日期格式 | |
FortDateTime(Date,vbShortTime) | 轉(zhuǎn)化為短時(shí)間格式 | |
FortDateTime(Date,vbLongTime) | 轉(zhuǎn)化為長(zhǎng)時(shí)間格式 |
日期或時(shí)間間隔因子
間隔因子 | yyyy | m | d | ww | h | s |
說(shuō)明 | 年 | 月 | 日 | 星期 | 小時(shí) | 秒 |
常用的檢驗(yàn)函數(shù)及功能
函數(shù) | 功能 |
VarType(variant) | 檢查變量vriant的值,函數(shù)值為該變量的數(shù)據(jù)子類(lèi)型,0表示空,2表示整數(shù),7表示日子,8表示字符串,11表示布爾變量,8192表示數(shù)組 |
IsNumeric(variant) | 檢查變量variant的值,如果variant是數(shù)值類(lèi)型,則函數(shù)值為ture |
IsNull(variant) | 檢查變量variant的值,如果variant為null,則函數(shù)值為ture |
IsEmpty(variant) | 檢查變量的值,如果variant是empty,則函數(shù)值為ture |
IsObject(variant) | 檢查變量variant的值,如果variant是對(duì)象類(lèi)型,則函數(shù)值為ture |
IsDate(variant) | 檢查變量variant的值,如果variant是日期類(lèi)型,則函數(shù)值為ture |
IsArray(variant) | 檢查變量variant的值,如果variant是數(shù)組類(lèi)型,則函數(shù)值為ture |
下面給大家一個(gè)常見(jiàn)實(shí)例,大家可以運(yùn)行測(cè)試
Option Explicit '*********************************Date/Time函數(shù)******************************* 'CDate函數(shù)把一個(gè)合法的日期和事件表達(dá)式轉(zhuǎn)換為Date類(lèi)型,并返回結(jié)果 Dim d1 Dim d2 Dim d3 d1="April 22,2001" If IsDate(d1) Then MsgBox CDate(d1) End If d2=#2/22/01# If IsDate(d2) Then MsgBox CDate(d2) End If d3="3:18:40 AM" If IsDate(d3) Then MsgBox CDate(d3) End If 'Date函數(shù)返回當(dāng)前系統(tǒng)的日期 '日期 MsgBox Date '日期+時(shí)間 MsgBox Now '時(shí)間 MsgBox Time 'DateAdd函數(shù)可返回已添加指定時(shí)間間隔的日期 MsgBox DateAdd("yyyy",1,"31-Jan-2003")'加一年 MsgBox DateAdd("yyyy",1,"31-Jan-2003")'減一年 MsgBox DateAdd("q",1,"31-Jan-2003")'加一個(gè)季度 MsgBox DateAdd("m",1,"31-Jan-2003")'加一個(gè)月 MsgBox DateAdd("y",1,"31-Jan-2003")'當(dāng)年的第幾天 MsgBox DateAdd("d",1,"31-Jan-2003")'增加一天 MsgBox DateAdd("w",1,"31-Jan-2003")'當(dāng)周的第幾天 MsgBox DateAdd("ww",1,"31-Jan-2003")'增加一個(gè)周 MsgBox DateAdd("h",1,"31-Jan-2003")'某日期的第一個(gè)小時(shí) MsgBox DateAdd("n",1,"31-Jan-2003")'某日期的第一分鐘 MsgBox DateAdd("s",1,"31-Jan-2003")'某日期的第一秒 'DateDiff函數(shù)可返回兩個(gè)日期之間的時(shí)間間隔數(shù) MsgBox DateDiff("yyyy",Date,"31-Jan-2012") MsgBox DateDiff("q",Date,"31-Jan-2012") MsgBox DateDiff("m",Date,"31-Jan-2012") MsgBox DateDiff("y",Date,"31-Jan-2012") MsgBox DateDiff("d",Date,"31-Jan-2012") MsgBox DateDiff("w",Date,"31-Jan-2012") MsgBox DateDiff("ww",Date,"31-Jan-2012") MsgBox DateDiff("h",Date,"31-Jan-2012") MsgBox DateDiff("n",Date,"31-Jan-2012") MsgBox DateDiff("s",Date,"31-Jan-2012") 'DatePart函數(shù)可返回給定日期的指定部分 Dim d d="2/10/2012 16:25:56" MsgBox DatePart("yyyy",d) MsgBox DatePart("m",d) MsgBox DatePart("q",d) MsgBox DatePart("w",d) MsgBox DatePart("ww",d) MsgBox DatePart("y",d) MsgBox DatePart("s",d) MsgBox DatePart("h",d) MsgBox DatePart("n",d) MsgBox DatePart("d",d) 'DateSerial函數(shù)可返回指定的年、月、日的子類(lèi)型Date的Variant MsgBox DateSerial(2012,2,30) 'DateValue函數(shù)返回一個(gè)日期類(lèi)型 MsgBox DateValue("31-Jan-2012 2:39:49 AM") 'Day函數(shù)可返回介于1到31之間的一個(gè)代表月的天數(shù)的數(shù)字 MsgBox Day(Date) 'FormatDateTime函數(shù)可格式化并返回一個(gè)額合法的日期或時(shí)間表達(dá)式 MsgBox FormatDateTime(Now,0) MsgBox FormatDateTime(Now,1) MsgBox FormatDateTime(Now,2) MsgBox FormatDateTime(Now,3) MsgBox FormatDateTime(Now,4) 'Hour函數(shù)可返回介于0到23之間的代表天的小時(shí)數(shù)的數(shù)字 MsgBox Hour(Now) 'IsDate函數(shù)可返回一個(gè)布爾值,指示經(jīng)計(jì)算的表達(dá)式是否可被轉(zhuǎn)換為日期,如果表達(dá)式是日期或可被轉(zhuǎn)換為日期,則返回True,否則,返回False。 MsgBox IsDate("15-3-2012") 'Minute函數(shù)可返回表示小時(shí)的分鐘數(shù)的數(shù)字 MsgBox Minute(Now) 'Month函數(shù)可返回表示年的月份的數(shù)字 MsgBox Month(Now) 'Second函數(shù)可返回表示分鐘的秒數(shù)的數(shù)字 MsgBox Second(Now) 'Time函數(shù)可返回當(dāng)前的系統(tǒng)時(shí)間 MsgBox Time 'Timer函數(shù)可返回午夜12時(shí)以后已經(jīng)過(guò)去的秒數(shù) MsgBox Timer 'TimeSerial函數(shù)可把時(shí)、分、秒合并成為時(shí)間 MsgBox TimeSerial(3,45,50) 'TimeValue函數(shù)可返回包含時(shí)間的日期子類(lèi)型的變量 MsgBox TimeValue(Now) 'Weekday函數(shù)可返回表示一周的天數(shù)的數(shù)字,介于1和7之間。 MsgBox Weekday(Date,0) 'WeekdayName函數(shù)可返回一周中指定一天的星期名 MsgBox WeekdayName(3) MsgBox WeekdayName(Weekday(Date,1)) 'Year函數(shù)可返回表示年份的一個(gè)數(shù)字 MsgBox Year(date) '*********************************Conversion函數(shù)******************************* 'Asc函數(shù)可把字符串中的第一個(gè)字母轉(zhuǎn)換為對(duì)應(yīng)的ANSI代碼,并返回結(jié)果 MsgBox Asc("A") MsgBox Asc("a") 'CBool函數(shù)可把表達(dá)式轉(zhuǎn)換為布爾類(lèi)型 Dim a a=5 MsgBox CBool(a) 'CByte函數(shù)可把表達(dá)式轉(zhuǎn)換為字節(jié)類(lèi)型 Dim b b=134.12345 MsgBox CByte(b) 'CCur函數(shù)可把表達(dá)式轉(zhuǎn)換為貨幣類(lèi)型 Dim c c=12345.12345656 MsgBox CCur(c) 'CDbl函數(shù)可把表達(dá)式轉(zhuǎn)換為雙精度類(lèi)型 Dim e e=123.12454656577435235436 MsgBox CDbl(e) 'Chr函數(shù)可把指定的ANSI字符代碼轉(zhuǎn)換為字符 MsgBox Chr(65) 'CInt函數(shù)可把表達(dá)式轉(zhuǎn)換為整數(shù)類(lèi)型 MsgBox CInt(12.3435) 'CLng函數(shù)可把表達(dá)式轉(zhuǎn)換為長(zhǎng)整形類(lèi)型 MsgBox CLng(12.676) MsgBox CLng(12.243) 'CSng函數(shù)可把表達(dá)式轉(zhuǎn)換為單精度類(lèi)型 MsgBox CSng(122.355465) MsgBox CSng(21.23222) 'CStr函數(shù)可把表達(dá)式轉(zhuǎn)換為字符串類(lèi)型 MsgBox CStr(false) MsgBox CStr(Date) MsgBox CStr(Empty) MsgBox CStr(Error) '*********************************Format函數(shù)******************************* 'FormatCurrency函數(shù)可返回作為貨幣值被格式化的表達(dá)式,使用系統(tǒng)控制面板中定義的貨幣符號(hào) MsgBox FormatCurrency(21.23456) 'FormatNumber函數(shù)可返回作為數(shù)字被格式化的表達(dá)式 MsgBox FormatNumber(12.23456775,3) 'FormatPercent函數(shù)可返回作為百分?jǐn)?shù)被格式化的表達(dá)式 MsgBox FormatPercent(3/7,3) '*********************************Math函數(shù)******************************* 'Abs函數(shù)可返回指定的數(shù)字的絕對(duì)值 MsgBox Abs(-9) 'Atn函數(shù)可返回指定數(shù)字的正切 MsgBox Atn(9) 'Cos函數(shù)可返回指定數(shù)字的余弦 MsgBox Cos(9) 'Exp函數(shù)可e的冪次方 MsgBox Exp(2.3) 'Fix函數(shù)可返回指定數(shù)字的整數(shù)部分 MsgBox Fix(-6.325) MsgBox Int(-6.325) 'Log函數(shù)可返回指定數(shù)據(jù)的自然對(duì)數(shù) MsgBox Log(10) 'Rnd函數(shù)可返回一個(gè)隨機(jī)數(shù),數(shù)字總是小于1但大于或等于0. MsgBox Rnd 'Sgn函數(shù)可返回指定數(shù)字的符號(hào)的整數(shù) MsgBox Sgn(15) MsgBox Sgn(-5) MsgBox Sgn(0) 'Sin函數(shù)可返回指定數(shù)字的正弦 MsgBox Sin(9) 'Sqr函數(shù)可返回一個(gè)數(shù)的平方根 MsgBox Sqr(9) 'Tan函數(shù)可返回指定數(shù)字的正切 MsgBox Tan(9) '*********************************Array函數(shù)******************************* 'Array可返回一個(gè)包含數(shù)組的變量 Dim Arr Arr=Array(1,2,3,4,5) MsgBox Arr(0) 'Filter函數(shù)可返回一個(gè)基于0的數(shù)組,此數(shù)組包含以特定過(guò)濾條件為基礎(chǔ)的字符串?dāng)?shù)組的子集 Dim Arr1(5),b Arr1(0)="Saturday" Arr1(1)="Sunday" Arr1(2)="Monday" Arr1(3)="Tuesday" Arr1(4)="Wednesday" b=Filter(Arr1,"n",True) MsgBox b(0) MsgBox b(1) MsgBox b(2) 'ISArray函數(shù)可返回一個(gè)指示指定的變量是否為數(shù)組的布爾值。如果變量為數(shù)組,則返回True,否則返回False。 Dim a(3) a(0)=1 a(1)=2 a(2)=3 MsgBox IsArray(a) 'Join函數(shù)可返回一個(gè)由某個(gè)數(shù)組中一系列子字符串組成的字符串 Dim a(5),b a(0)="Saturday" a(1)="Sunday" a(2)="Monday" a(3)="Wendesday" a(4)="Tuesday" b=Filter(a,"n",True) MsgBox Join(b,",") 'LBound函數(shù)可返回指示數(shù)組維數(shù)的最小下標(biāo)。(始終為0) 'UBound函數(shù)可返回指示數(shù)組維數(shù)的最大下標(biāo)。 Dim a(5) MsgBox LBound(a) MsgBox UBound(a) 'Split函數(shù)可返回基于0的一維數(shù)組,此數(shù)組包含指定的子字符串 Dim txt,a txt="hello/world!" a=Split(txt,"/") MsgBox a(0) MsgBox a(1) '*********************************String函數(shù)******************************* 'InStr函數(shù)可返回一個(gè)字符串在另一個(gè)字符串中首次出現(xiàn)的位置 Dim txt,pos txt="This is a beautiful day!" pos=InStr(4,txt,"is",1) MsgBox pos 'InStrRev函數(shù)可返回一個(gè)字符串在另一個(gè)字符串中首次出現(xiàn)的位置,搜索從字符串的末端開(kāi)始,但是返回的位置是從字符串的起點(diǎn)開(kāi)始計(jì)數(shù)的。 Dim txt,pos txt="This is a beautiful day!" pos=InStrRev(txt,"i",-1,1) MsgBox pos 'LCase函數(shù)可把指定的字符串轉(zhuǎn)換為小寫(xiě) 'UCase函數(shù)可把指定的字符串轉(zhuǎn)換為大寫(xiě) Dim txt,pos1,pos2 txt="This Is A Beautiful Day!" pos1=LCase(txt) pos2=UCase(txt) MsgBox pos1 MsgBox pos2 'Left函數(shù)可從字符串的左側(cè)返回指定數(shù)目的字符 'Right函數(shù)可從字符串的右側(cè)返回指定數(shù)目的字符 Dim txt,pos1,pos2 txt="This is a beautiful day!" pos1=Left(txt,5) pos2=Right(txt,6) MsgBox pos1 MsgBox pos2 'Len函數(shù)可返回字符串中字符的數(shù)目 Dim txt,pos txt="This is a beautiful day!" pos=Len(txt) MsgBox pos 'LTrim函數(shù)可刪除字符串左側(cè)的空格 'RTrim函數(shù)可刪除字符串右側(cè)的空格 'Trim函數(shù)可刪除字符串兩端的空格 Dim txt,pos1,pos2,pos3 txt=" This is a beautiful day! " pos1=LTrim(txt) pos2=RTrim(txt) pos3=Trim(txt) MsgBox pos1 MsgBox pos2 MsgBox pos3 MsgBox Len(pos1) MsgBox Len(pos2) MsgBox Len(pos3) 'Mid函數(shù)可從字符串中返回指定數(shù)目的字符 Dim txt txt="This is a beautiful day!" MsgBox Mid(txt,1,5) MsgBox Mid(txt,2,5) MsgBox Mid(txt,1) MsgBox Mid(txt,5) 'Replace函數(shù)可使用一個(gè)字符串替換另一個(gè)字符串指定的次數(shù) Dim txt txt="This is a beautiful day!" MsgBox Replace(txt,"is","AA",4,2) 'Space函數(shù)可返回一個(gè)由指定數(shù)目的空格組成的字符串 Dim txt txt=Space(20) MsgBox txt MsgBox Len(txt) 'StrComp函數(shù)可比較兩個(gè)字符串,并返回表示比較結(jié)果的一個(gè)值 Dim txt1,txt2 txt1="hello" txt2="hell" MsgBox StrComp(txt1,txt2) 'String函數(shù)可返回包含指定長(zhǎng)度的重復(fù)字符的一個(gè)字符串 MsgBox String(10,"*") 'StrReverse函數(shù)可反轉(zhuǎn)一個(gè)字符串 Dim txt txt="This is a beautiful day!" MsgBox StrReverse(txt) '*********************************其他函數(shù)******************************* 'InputBox函數(shù)可顯示一個(gè)對(duì)話(huà)框,用戶(hù)可在其中輸入文本或點(diǎn)擊一個(gè)按鈕。 Dim fname fname=InputBox("Enter your name:") MsgBox ("Your name is "&fname) 'IsEmpty函數(shù)可返回指定的變量是否被初始化的布爾值。 Dim x,y y=10 MsgBox IsEmpty(x) MsgBox IsEmpty(y) 'IsNull函數(shù)可返回指定表達(dá)式是否無(wú)效數(shù)據(jù)的布爾值 Dim x,y,z x=Null y=10 z="" MsgBox IsNull(x) MsgBox IsNull(y) MsgBox IsNull(z) 'IsNumeric函數(shù)可返回指示指定的表達(dá)式是否可作為數(shù)字來(lái)計(jì)算的布爾值。 Dim x x=10 MsgBox IsNumeric(x) x=Empty MsgBox IsNumeric(x) x="1 h" MsgBox IsNumeric(x)
這篇關(guān)于vbscript常見(jiàn)函數(shù)的文章就介紹到這里,希望大家以后多多支持腳本之家。
相關(guān)文章
VBS和頁(yè)面中響應(yīng)COM的事件的方法和代碼
VBS和頁(yè)面中響應(yīng)COM的事件的方法和代碼...2007-03-03可以定時(shí)自動(dòng)關(guān)機(jī)的vbs腳本
可以定時(shí)自動(dòng)關(guān)機(jī)的vbs腳本...2007-02-02VBS 自動(dòng)登錄論壇的實(shí)現(xiàn)代碼
這篇文章主要介紹了如果通過(guò)vbs實(shí)現(xiàn)論壇自動(dòng)登錄的實(shí)現(xiàn)方法,其實(shí)主要利用了vbs操作網(wǎng)頁(yè)表單的自動(dòng)填寫(xiě)實(shí)現(xiàn),喜歡的朋友可以試試2013-07-07將WMI中的DateTime類(lèi)型轉(zhuǎn)換成VBS時(shí)間的函數(shù)代碼
WMI中的DateTime數(shù)據(jù)類(lèi)型保存的時(shí)間格式是UTC,與VBS中的時(shí)間類(lèi)型不同。2011-02-02利用VBS發(fā)送短信的實(shí)現(xiàn)代碼(通過(guò)飛信)
無(wú)意中看到百度 VBS 貼吧里一個(gè)標(biāo)題為《無(wú)私的奉獻(xiàn)出我的用飛信免費(fèi)發(fā)短信接口》的帖子。2011-08-08用vbs實(shí)現(xiàn)虛擬主機(jī)和域名查循的腳本
用vbs實(shí)現(xiàn)的可以查詢(xún)虛擬主機(jī)和域名信息的腳本代碼,保存為vbs運(yùn)行即可2008-06-06