VBScript Tutorials - Herong's Tutorial Examples
∟Variant Data Type, Subtypes, and Literals
∟Data Literals
This section provides a quick introduction of data subtype literals. Examples of data literals are provided for Integer, Long, Single, Double, String, Boolean, Date, Empty and Null.
Data Literal: A piece of code in a VBScript statement to represent a data value of a specific subtype.
VBScript provides the following syntax rules for data literals of different subtypes:
- Byte Literal - Not exist. So there is no way to enter a Byte value into a VBScript code.
If you need a Byte value, you can use the conversion function CByte() to convert an integer number
value into a Byte value, like CByte(7).
- Integer Literal - A singed integer number within the Integer value range in decimal format,
like -8, 0, and 777.
- Long Literal - A singed integer number within the Long value range,
but outside the Integer value range, in decimal format,
like -888888 and 777777.
- Single Literal - Not exist. So there is no way to enter a Single value into a VBScript code.
If you need a Single value, you can use the conversion function CSng() to convert a real number
value into a Single value, like CSng(0.00314159e30).
- Double: Literal - A signed real number within the Double value range
in the scientific format with a decimal point and/or an exponential part,
like 9.99, 0.00314159e30 and 333.333e200.
- Currency Literal - Not exist. So there is no way to enter a Currency value into a VBScript code.
If you need a Currency value, you can use the conversion function CCur() to convert a decimal number
value into a Currency value, like CCur(9.99).
- String Literal - A sequence of characters enclosed in double quotes ("), like "Hello".
- Boolean Literal - One of two keywords: True and False.
- Date Literal - A string representing a date and/or time enclosed in hash signs (#), #31-Dec-1999#.
- Empty Literal - The keyword: Empty
- Null Literal - The keyword: Null
- Object Literal - Not sure. We will find out later.
- Error Literal - Not sure. We will find out later.
Read the next section for more examples of literals of different data subtypes.
Table of Contents
About This Book
Introduction of VBScript - Visual Basic Scripting Edition
►Variant Data Type, Subtypes, and Literals
"Variant" - Data Type and Subtypes
►Data Literals
Data Literal Examples
String Data Literals
Date and Time Data Literals
Arithmetic Operations
Numeric Comparison Operations and Logical Operations
String Operations - Concatenation and Comparison
Variable Declaration and Assignment Statement
Expression and Order of Operation Precedence
Statement Syntax and Statement Types
Array Data Type and Related Statements
Array References and Array Assignment Statements
Conditional Statements - "If ... Then" and "Select Case"
Loop Statements - "For", "While", and "Do"
"Function" and "Sub" Procedures
Built-in Functions
Inspecting Variables Received in Procedures
Error Handling Flag and the "Err" Object
Regular Expression Pattern Match and Replacement
scrrun.dll - Scripting Runtime DLL Library
Creating Your Own Classes
IE Web Browser Supporting VBScript
IIS ASP Server Supporting VBScript
WSH (Windows Script Host)
References
Full Version in PDF/EPUB