获取在VBScript变量的类型 [英] Get the type of a variable in VBScript

查看:127
本文介绍了获取在VBScript变量的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用VBScript变量的类型?


解决方案

是的 VarType函数你需要什么?


  

返回指示变量子类型的值。


  + -------------- + ------- + -------------- ------------------------------- +
|恒|值|说明|
+ -------------- + ------- + -------------------------- ------------------- +
| vbEmpty | 0 |空(初始化)|
|是vbNull | 1 |空(无有效数据)|
| vbInteger | 2 |整数|
| vbLong | 3 |长整型|
| vbSingle | 4 |单precision浮点数|
| vbDouble | 5 |双precision浮点数|
| vbCurrency | 6 |货币|
| vbDate | 7 |日期|
| vbString | 8 |串|
| vbObject | 9 |自动化对象|
| vbError | 10 |错误|
| vbBoolean | 11 |布尔|
| vbVariant | 12 |变量(只和变量数组使用)|
| vbDataObject | 13 |一个数据访问对象|
| vbDecimal | 14 |十进制值|
| vbByte | 17 |字节|
| vbLongLong | 20 |龙龙整数(64位)|
| VBArray的| 8192 |阵列|
+ -------------- + ------- + -------------------------- ------------------- +


  

VarType函数从不通过自己返回Array的值。它
  总是被添加到其他值来表示的数组
  特殊类型。当它仅返回变体的值
  被添加到值阵列以指示该参数的
  VarType函数是一个数组。例如,返回的值一个
  整数数组计算为2 + 8192或8194.如果一个对象有
  默认属性,VarType函数(对象)返回其默认的类型
  属性。


How do I get the type of a variable using VBScript?

解决方案

Is VarType what you need?

Returns a value indicating the subtype of a variable.

+--------------+-------+---------------------------------------------+
|   Constant   | Value |                 Description                 |
+--------------+-------+---------------------------------------------+
| vbEmpty      |     0 | Empty (uninitialized)                       |
| vbNull       |     1 | Null (no valid data)                        |
| vbInteger    |     2 | Integer                                     |
| vbLong       |     3 | Long integer                                |
| vbSingle     |     4 | Single-precision floating-point number      |
| vbDouble     |     5 | Double-precision floating-point number      |
| vbCurrency   |     6 | Currency                                    |
| vbDate       |     7 | Date                                        |
| vbString     |     8 | String                                      |
| vbObject     |     9 | Automation object                           |
| vbError      |    10 | Error                                       |
| vbBoolean    |    11 | Boolean                                     |
| vbVariant    |    12 | Variant (used only with arrays of Variants) |
| vbDataObject |    13 | A data-access object                        |
| vbDecimal    |    14 | Decimal Value                               |
| vbByte       |    17 | Byte                                        |
| vbLongLong   |    20 | LongLong integer (64 bit)                   |
| vbArray      |  8192 | Array                                       |
+--------------+-------+---------------------------------------------+

The VarType function never returns the value for Array by itself. It is always added to some other value to indicate an array of a particular type. The value for Variant is only returned when it has been added to the value for Array to indicate that the argument to the VarType function is an array. For example, the value returned for an array of integers is calculated as 2 + 8192, or 8194. If an object has a default property, VarType (object) returns the type of its default property.

这篇关于获取在VBScript变量的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆