VBScript TypeName 函數(shù)
定義和用法
TypeName 函數(shù)可指定變量的子類型。
TypeName 函數(shù)可返回的值:
| 值 | 描述 |
|---|---|
| Byte | 字節(jié)值 |
| Integer | 整型值 |
| Long | 長(zhǎng)整型值 |
| Single | 單精度浮點(diǎn)值 |
| Double | 雙精度浮點(diǎn)值 |
| Currency | 貨幣值 |
| Decimal | 十進(jìn)制值 |
| Date | 日期或時(shí)間值 |
| String | 字符串值 |
| Boolean | Boolean 值;True 或 False |
| Empty | 未初始化 |
| Null | 無(wú)有效數(shù)據(jù) |
| <object type> | 實(shí)際對(duì)象類型名 |
| Object | 一般對(duì)象 |
| Unknown | 未知對(duì)象類型 |
| Nothing | 還未引用對(duì)象實(shí)例的對(duì)象變量 |
| Error | 錯(cuò)誤 |
語(yǔ)法
TypeName(varname)
| 參數(shù) | 描述 |
|---|---|
| varname | 必需的。變量的名稱。 |
實(shí)例
dim x x="Hello World!" document.write(TypeName(x)) x=4 document.write(TypeName(x)) x=4.675 document.write(TypeName(x)) x=Null document.write(TypeName(x)) x=Empty document.write(TypeName(x)) x=True document.write(TypeName(x))
輸出:
String Integer Double Null Empty Boolean