Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

VBScript VarType 函数


❮ 完整的 VBScript 参考

VarType 函数返回一个值,该值指示指定变量的子类型。

VarType 函数可以返回以下值之一:

  • 0 = vbEmpty - 指示为空(未初始化)
  • 1 = vbNull - 指示为空(没有有效数据)
  • 2 = vbInteger - 指示为整数
  • 3 = vbLong - 指示为长整数
  • 4 = vbSingle - 指示为单精度浮点数
  • 5 = vbDouble - 指示为双精度浮点数
  • 6 = vbCurrency - 指示为货币
  • 7 = vbDate - 指示为日期
  • 8 = vbString - 指示为字符串
  • 9 = vbObject - 指示为自动化对象
  • 10 = vbError - 指示为错误
  • 11 = vbBoolean - 指示为布尔值
  • 12 = vbVariant - 指示为变体(仅在变体数组中使用)
  • 13 = vbDataObject - 指示为数据访问对象
  • 14 = vbDecimal - 指示为十进制
  • 17 = vbByte - 指示为字节
  • 20 = vbLongLong - 指示为 LongLong 整数(仅在 64 位平台上有效)
  • 36 = vbUserDefinedType - 指示包含用户定义类型的变体
  • 8192 = vbArray - 指示为数组

注意:如果变量是数组,则 VarType() 返回 8192 + VarType(数组元素)。例如:对于整数数组,VarType() 将返回 8192 + 2 = 8194。

语法

VarType(varname)

参数 描述
varname 必需。变量名

示例

示例

<%

x="Hello World!"
response.write(VarType(x) & "<br />")
x=4
response.write(VarType(x) & "<br />")
x=4.675
response.write(VarType(x) & "<br />")
x=Null
response.write(VarType(x) & "<br />")
x=Empty
response.write(VarType(x) & "<br />")
x=True
response.write(VarType(x))

%>

以上代码的输出将是

8
2
5
1
0
11
显示示例 »

❮ 完整的 VBScript 参考
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.