VBScript TypeName 函数
定义和用法
TypeName 函数可指定变量的子类型。
TypeName 函数可返回的值:
| 值 | 描述 |
|---|---|
| Byte | 字节值 |
| Integer | 整型值 |
| Long | 长整型值 |
| Single | 单精度浮点值 |
| Double | 双精度浮点值 |
| Currency | 货币值 |
| Decimal | 十进制值 |
| Date | 日期或时间值 |
| String | 字符串值 |
| Boolean | Boolean 值;True 或 False |
| Empty | 未初始化 |
| Null | 无有效数据 |
| <object type> | 实际对象类型名 |
| Object | 一般对象 |
| Unknown | 未知对象类型 |
| Nothing | 还未引用对象实例的对象变量 |
| Error | 错误 |
语法
TypeName(varname)
| 参数 | 描述 |
|---|---|
| varname | 必需的。变量的名称。 |
实例
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