VBScript Functions and Keyword

<H2>Date/Time Functions</H2>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>CDate</TD>
<TD vAlign=top>Converts a valid date and time expression to the variant of subtype Date</TD></TR>
<TR>
<TD vAlign=top>Date</TD>
<TD vAlign=top>Returns the current system date</TD></TR>
<TR>
<TD vAlign=top>DateAdd</TD>
<TD vAlign=top>Returns a date to which a specified time interval has been added</TD></TR>
<TR>
<TD vAlign=top>DateDiff</TD>
<TD vAlign=top>Returns the number of intervals between two dates</TD></TR>
<TR>
<TD vAlign=top>DatePart</TD>
<TD vAlign=top>Returns the specified part of a given date</TD></TR>
<TR>
<TD vAlign=top>DateSerial</TD>
<TD vAlign=top>Returns the date for a specified year, month, and day</TD></TR>
<TR>
<TD vAlign=top>DateValue</TD>
<TD vAlign=top>Returns a date</TD></TR>
<TR>
<TD vAlign=top>Day</TD>
<TD vAlign=top>Returns a number that represents the day of the month (between 1 and 31, inclusive)</TD></TR>
<TR>
<TD vAlign=top>FormatDateTime</TD>
<TD vAlign=top>Returns an expression formatted as a date or time</TD></TR>
<TR>
<TD vAlign=top>Hour</TD>
<TD vAlign=top>Returns a number that represents the hour of the day (between 0 and 23, inclusive)</TD></TR>
<TR>
<TD vAlign=top>IsDate</TD>
<TD vAlign=top>Returns a Boolean value that indicates if the evaluated expression can be converted to a date</TD></TR>
<TR>
<TD vAlign=top>Minute</TD>
<TD vAlign=top>Returns a number that represents the minute of the hour (between 0 and 59, inclusive)</TD></TR>
<TR>
<TD vAlign=top>Month</TD>
<TD vAlign=top>Returns a number that represents the month of the year (between 1 and 12, inclusive)</TD></TR>
<TR>
<TD vAlign=top>MonthName</TD>
<TD vAlign=top>Returns the name of a specified month</TD></TR>
<TR>
<TD vAlign=top>Now</TD>
<TD vAlign=top>Returns the current system date and time</TD></TR>
<TR>
<TD vAlign=top>Second</TD>
<TD vAlign=top>Returns a number that represents the second of the minute (between 0 and 59, inclusive)</TD></TR>
<TR>
<TD vAlign=top>Time</TD>
<TD vAlign=top>Returns the current system time</TD></TR>
<TR>
<TD vAlign=top>Timer</TD>
<TD vAlign=top>Returns the number of seconds since 12:00 AM</TD></TR>
<TR>
<TD vAlign=top>TimeSerial</TD>
<TD vAlign=top>Returns the time for a specific hour, minute, and second</TD></TR>
<TR>
<TD vAlign=top>TimeValue</TD>
<TD vAlign=top>Returns a time</TD></TR>
<TR>
<TD vAlign=top>Weekday</TD>
<TD vAlign=top>Returns a number that represents the day of the week (between 1 and 7, inclusive)</TD></TR>
<TR>
<TD vAlign=top>WeekdayName</TD>
<TD vAlign=top>Returns the weekday name of a specified day of the week</TD></TR>
<TR>
<TD vAlign=top>Year</TD>
<TD vAlign=top>Returns a number that represents the year</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>Conversion Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>Asc</TD>
<TD vAlign=top>Converts the first letter in a string to ANSI code</TD></TR>
<TR>
<TD vAlign=top>CBool</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Boolean</TD></TR>
<TR>
<TD vAlign=top>CByte</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Byte</TD></TR>
<TR>
<TD vAlign=top>CCur</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Currency</TD></TR>
<TR>
<TD vAlign=top>CDate</TD>
<TD vAlign=top>Converts a valid date and time expression to the variant of subtype Date</TD></TR>
<TR>
<TD vAlign=top>CDbl</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Double</TD></TR>
<TR>
<TD vAlign=top>Chr</TD>
<TD vAlign=top>Converts the specified ANSI code to a character</TD></TR>
<TR>
<TD vAlign=top>CInt</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Integer</TD></TR>
<TR>
<TD vAlign=top>CLng</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Long</TD></TR>
<TR>
<TD vAlign=top>CSng</TD>
<TD vAlign=top>Converts an expression to a variant of subtype Single</TD></TR>
<TR>
<TD vAlign=top>CStr</TD>
<TD vAlign=top>Converts an expression to a variant of subtype String</TD></TR>
<TR>
<TD vAlign=top>Hex</TD>
<TD vAlign=top>Returns the hexadecimal value of a specified number</TD></TR>
<TR>
<TD vAlign=top>Oct</TD>
<TD vAlign=top>Returns the octal value of a specified number</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>Format Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>FormatCurrency</TD>
<TD vAlign=top>Returns an expression formatted as a currency value</TD></TR>
<TR>
<TD vAlign=top>FormatDateTime</TD>
<TD vAlign=top>Returns an expression formatted as a date or time</TD></TR>
<TR>
<TD vAlign=top>FormatNumber</TD>
<TD vAlign=top>Returns an expression formatted as a number</TD></TR>
<TR>
<TD vAlign=top>FormatPercent</TD>
<TD vAlign=top>Returns an expression formatted as a percentage</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>Math Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>Abs</TD>
<TD vAlign=top>Returns the absolute value of a specified number</TD></TR>
<TR>
<TD vAlign=top>Atn</TD>
<TD vAlign=top>Returns the arctangent of a specified number</TD></TR>
<TR>
<TD vAlign=top>Cos</TD>
<TD vAlign=top>Returns the cosine of a specified number (angle)</TD></TR>
<TR>
<TD vAlign=top>Exp</TD>
<TD vAlign=top>Returns <EM>e</EM> raised to a power</TD></TR>
<TR>
<TD vAlign=top>Hex</TD>
<TD vAlign=top>Returns the hexadecimal value of a specified number</TD></TR>
<TR>
<TD vAlign=top>Int</TD>
<TD vAlign=top>Returns the integer part of a specified number</TD></TR>
<TR>
<TD vAlign=top>Fix</TD>
<TD vAlign=top>Returns the integer part of a specified number</TD></TR>
<TR>
<TD vAlign=top>Log</TD>
<TD vAlign=top>Returns the natural logarithm of a specified number</TD></TR>
<TR>
<TD vAlign=top>Oct</TD>
<TD vAlign=top>Returns the octal value of a specified number</TD></TR>
<TR>
<TD vAlign=top>Rnd</TD>
<TD vAlign=top>Returns a random number less than 1 but greater or equal to 0</TD></TR>
<TR>
<TD vAlign=top>Sgn</TD>
<TD vAlign=top>Returns an integer that indicates the sign of a specified number</TD></TR>
<TR>
<TD vAlign=top>Sin</TD>
<TD vAlign=top>Returns the sine of a specified number (angle)</TD></TR>
<TR>
<TD vAlign=top>Sqr</TD>
<TD vAlign=top>Returns the square root of a specified number</TD></TR>
<TR>
<TD vAlign=top>Tan</TD>
<TD vAlign=top>Returns the tangent of a specified number (angle)</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>Array Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>Array</TD>
<TD vAlign=top>Returns a variant containing an array</TD></TR>
<TR>
<TD vAlign=top>Filter</TD>
<TD vAlign=top>Returns a zero-based array that contains a subset of a string array based on a filter criteria</TD></TR>
<TR>
<TD vAlign=top>IsArray</TD>
<TD vAlign=top>Returns a Boolean value that indicates whether a specified variable is an array</TD></TR>
<TR>
<TD vAlign=top>Join</TD>
<TD vAlign=top>Returns a string that consists of a number of substrings in an array</TD></TR>
<TR>
<TD vAlign=top>LBound</TD>
<TD vAlign=top>Returns the smallest subscript for the indicated dimension of an array</TD></TR>
<TR>
<TD vAlign=top>Split</TD>
<TD vAlign=top>Returns a zero-based, one-dimensional array that contains a specified number of substrings</TD></TR>
<TR>
<TD vAlign=top>UBound</TD>
<TD vAlign=top>Returns the largest subscript for the indicated dimension of an array</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>String Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>InStr</TD>
<TD vAlign=top>Returns the position of the first occurrence of one string within another. The search begins at the first character of the string</TD></TR>
<TR>
<TD vAlign=top>InStrRev</TD>
<TD vAlign=top>Returns the position of the first occurrence of one string within another. The search begins at the last character of the string</TD></TR>
<TR>
<TD vAlign=top>LCase</TD>
<TD vAlign=top>Converts a specified string to lowercase</TD></TR>
<TR>
<TD vAlign=top>Left</TD>
<TD vAlign=top>Returns a specified number of characters from the left side of a string</TD></TR>
<TR>
<TD vAlign=top>Len</TD>
<TD vAlign=top>Returns the number of characters in a string</TD></TR>
<TR>
<TD vAlign=top>LTrim</TD>
<TD vAlign=top>Removes spaces on the left side of a string</TD></TR>
<TR>
<TD vAlign=top>RTrim</TD>
<TD vAlign=top>Removes spaces on the right side of a string</TD></TR>
<TR>
<TD vAlign=top>Trim</TD>
<TD vAlign=top>Removes spaces on both the left and the right side of a string</TD></TR>
<TR>
<TD vAlign=top>Mid</TD>
<TD vAlign=top>Returns a specified number of characters from a string</TD></TR>
<TR>
<TD vAlign=top>Replace</TD>
<TD vAlign=top>Replaces a specified part of a string with another string a specified number of times</TD></TR>
<TR>
<TD vAlign=top>Right</TD>
<TD vAlign=top>Returns a specified number of characters from the right side of a string</TD></TR>
<TR>
<TD vAlign=top>Space</TD>
<TD vAlign=top>Returns a string that consists of a specified number of spaces</TD></TR>
<TR>
<TD vAlign=top>StrComp</TD>
<TD vAlign=top>Compares two strings and returns a value that represents the result of the comparison</TD></TR>
<TR>
<TD vAlign=top>String</TD>
<TD vAlign=top>Returns a string that contains a repeating character of a specified length</TD></TR>
<TR>
<TD vAlign=top>StrReverse</TD>
<TD vAlign=top>Reverses a string</TD></TR>
<TR>
<TD vAlign=top>UCase</TD>
<TD vAlign=top>Converts a specified string to uppercase</TD></TR></TBODY></TABLE><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="70%">
<H2>Other Functions</H2></TD>
<TD align=right width="30%">Top</TD></TR></TBODY></TABLE>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Function</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>CreateObject</TD>
<TD vAlign=top>Creates an object of a specified type</TD></TR>
<TR>
<TD vAlign=top>Eval</TD>
<TD vAlign=top>Evaluates an expression and returns the result</TD></TR>
<TR>
<TD vAlign=top>GetLocale</TD>
<TD vAlign=top>Returns the current locale ID</TD></TR>
<TR>
<TD vAlign=top>GetObject</TD>
<TD vAlign=top>Returns a reference to an automation object from a file</TD></TR>
<TR>
<TD vAlign=top>GetRef</TD>
<TD vAlign=top>Allows you to connect a VBScript procedure to a DHTML event on your pages</TD></TR>
<TR>
<TD vAlign=top>InputBox</TD>
<TD vAlign=top>Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents</TD></TR>
<TR>
<TD vAlign=top>IsEmpty</TD>
<TD vAlign=top>Returns a Boolean value that indicates whether a specified variable has been initialized or not</TD></TR>
<TR>
<TD vAlign=top>IsNull</TD>
<TD vAlign=top>Returns a Boolean value that indicates whether a specified expression contains no valid data (Null)</TD></TR>
<TR>
<TD vAlign=top>IsNumeric</TD>
<TD vAlign=top>Returns a Boolean value that indicates whether a specified expression can be evaluated as a number</TD></TR>
<TR>
<TD vAlign=top>IsObject</TD>
<TD vAlign=top>Returns a Boolean value that indicates whether the specified expression is an automation object</TD></TR>
<TR>
<TD vAlign=top>LoadPicture</TD>
<TD vAlign=top>Returns a picture object. Available only on 32-bit platforms</TD></TR>
<TR>
<TD vAlign=top>MsgBox</TD>
<TD vAlign=top>Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked</TD></TR>
<TR>
<TD vAlign=top>RGB</TD>
<TD vAlign=top>Returns a number that represents an RGB color value</TD></TR>
<TR>
<TD vAlign=top>Round</TD>
<TD vAlign=top>Rounds a number</TD></TR>
<TR>
<TD vAlign=top>ScriptEngine</TD>
<TD vAlign=top>Returns the scripting language in use</TD></TR>
<TR>
<TD vAlign=top>ScriptEngineBuildVersion</TD>
<TD vAlign=top>Returns the build version number of the scripting engine in use</TD></TR>
<TR>
<TD vAlign=top>ScriptEngineMajorVersion</TD>
<TD vAlign=top>Returns the major version number of the scripting engine in use</TD></TR>
<TR>
<TD vAlign=top>ScriptEngineMinorVersion</TD>
<TD vAlign=top>Returns the minor version number of the scripting engine in use</TD></TR>
<TR>
<TD vAlign=top>SetLocale</TD>
<TD vAlign=top>Sets the locale ID and returns the previous locale ID</TD></TR>
<TR>
<TD vAlign=top>TypeName</TD>
<TD vAlign=top>Returns the subtype of a specified variable</TD></TR>
<TR>
<TD vAlign=top>VarType</TD>
<TD vAlign=top>Returns a value that indicates the subtype of a specified variable</TD></TR></TBODY></TABLE><BR>
<H2>VBScript Keywords</H2>
<TABLE class=ex cellSpacing=0 width="100%" border=1>
<TBODY>
<TR>
<TH align=left width="32%">Keyword</TH>
<TH align=left width="68%">Description</TH></TR>
<TR>
<TD vAlign=top>empty</TD>
<TD vAlign=top>
<P>Used to indicate an uninitialized variable value. A variable value is uninitialized when it is first created and no value is assigned to it, or when a variable value is explicitly set to empty.</P>
<P>Example:<BR>dim x&nbsp;&nbsp; 'the variable x is uninitialized!<BR>x="ff"&nbsp;&nbsp; 'the variable x is NOT uninitialized anymore<BR>x=empty&nbsp;&nbsp; 'the variable x is uninitialized!</P>
<P><STRONG>Note:</STRONG> This is not the same as Null!!</P></TD></TR>
<TR>
<TD vAlign=top>isEmpty</TD>
<TD vAlign=top>
<P>Used to test if a variable is uninitialized.</P>
<P>Example: If (isEmpty(x)) 'is x uninitialized?</P></TD></TR>
<TR>
<TD vAlign=top>nothing</TD>
<TD vAlign=top>Used to indicate an uninitialized object value, or to disassociate an object variable from an object to release system resources.
<P>Example: set myObject=nothing</P></TD></TR>
<TR>
<TD vAlign=top>is nothing</TD>
<TD vAlign=top>Used to test if a value is an initialized object.
<P>Example: If (myObject Is Nothing) 'is it unset?</P>
<P><STRONG>Note:</STRONG> If you compare a value to Nothing, you will not get the right result! Example: If (myObject = Nothing) 'always false!</P></TD></TR>
<TR>
<TD vAlign=top>null</TD>
<TD vAlign=top>Used to indicate that a variable contains no valid data.
<P>One way to think of Null is that someone has explicitly set the value to "invalid", unlike Empty where the value is "not set".</P>
<P><STRONG>Note:</STRONG> This is not the same as Empty or Nothing!!</P>
<P>Example: x=Null 'x contains no valid data</P></TD></TR>
<TR>
<TD vAlign=top>isNull</TD>
<TD vAlign=top>Used to test if a value contains invalid data.
<P>Example: if (isNull(x)) 'is x invalid?</P></TD></TR>
<TR>
<TD vAlign=top>true</TD>
<TD vAlign=top>Used to indicate a Boolean condition that is correct (true has a value of -1)</TD></TR>
<TR>
<TD vAlign=top>false</TD>
<TD vAlign=top>Used to indicate a Boolean condition that is not correct (false has a value of 0)</TD></TR></TBODY></TABLE>
<P>&nbsp;</P>

posted on 2008-07-08 14:10  Mat  阅读(266)  评论(0编辑  收藏  举报

导航