Visual Basic Scripting Edition | 語言參考 |
返回一個(gè)字符串,提供有關(guān)變量的 Variant 子類型信息。
TypeName(varname)
必選項(xiàng)的 varname 參數(shù),可以是任何變量。
TypeName 函數(shù)返回值如下:
值 | 描述 |
---|---|
Byte | 字節(jié)值 |
Integer | 整型值 |
Long | 長整型值 |
Single | 單精度浮點(diǎn)值 |
Double | 雙精度浮點(diǎn)值 |
Currency | 貨幣值 |
Decimal | 十進(jìn)制值 |
Date | 日期或時(shí)間值 |
String | 字符串值 |
Boolean | Boolean 值;True 或 False |
Empty | 未初始化 |
Null | 無有效數(shù)據(jù) |
<object type> | 實(shí)際對(duì)象類型名 |
Object | 一般對(duì)象 |
Unknown | 未知對(duì)象類型 |
Nothing | 還未引用對(duì)象實(shí)例的對(duì)象變量 |
Error | 錯(cuò)誤 |
下面的示例利用 TypeName 函數(shù)返回變量信息:
Dim ArrayVar(4), MyType NullVar = Null '
賦Null
值。MyType = TypeName("VBScript") '
返回"String"
。MyType = TypeName(4) '
返回"Integer"
。MyType = TypeName(37.50) '
返回"Double"
。MyType = TypeName(NullVar) '
返回"Null"
。MyType = TypeName(ArrayVar) '
返回"Variant()"
。
IsArray 函數(shù) | IsDate 函數(shù) | IsEmpty 函數(shù) | IsNull 函數(shù) | IsNumeric 函數(shù) | IsObject 函數(shù) | VarType 函數(shù)