Not all functions are carried over to VBScript, just like not all of the statements are carried over. A complete list of functions available in VBScript is shown in Table 13.6.
Table 13.6: Functions Available in VBScript
Function | Description |
Abs | Returns the absolute value of a number |
Array | Returns a variant containing an array with the specified values |
Asc/AscB/AscW | Returns the ASCII value of a character |
Atn | Returns the arctangent of the argument |
Chr/ChrB/ChrW | Returns a character for a specific ASCII value |
Cbool | Converts a value to Boolean |
Cbyte | Converts a value to Byte |
Ccur | Converts a value to Currency |
Cdate | Converts a value to Date |
CDbl | Converts a value to Double |
Cint | Converts a value to Integer |
CLng | Converts a value to Long |
Cos | Returns the cosine of the argument |
CreateObject | Creates a new instance of the specified object |
CSng | Converts a value to Single |
Date | Returns the current date |
DateSerial | Converts month, day, and year values to a Date value |
DateValue | Returns a date part of a Date value |
Exp | Returns the exponential of the argument |
Filter | Returns a string array that meets the specified filter criteria |
Fix | Returns the integer part of a number (Fix (1.2) = 1 and Fix(-1.2) = -1) |
FormatCurrency | Formats a value as currency |
FormatDateTime | Formats a value as a date or time |
FormatNumber | Formats a number |
FormatPercent | Formats a number as a percentage |
GetObject | Returns a reference to an automation object |
Hex | Returns a string containing the hexadecimal value of a number |
InputBox | Displays a dialog box with a prompt for an input value |
InStr/InStrB | Returns the starting position of the specified substring |
InStrRev | Similar to InStr but starts at the end of the string. |
Int | Returns an integer part of a number. (Fix (1.2) = 1 and Fix (-1.2) = -2) |
IsArray | Returns True if the argument is an array |
IsDate | Returns True if the argument contains a valid Date value |
IsEmpty | Returns True if the argument has been initialized |
IsNull | Returns True if the argument contains valid data |
IsNumeric | Returns True if the argument contains a valid number |
IsObject | Returns True if the argument contains an object |
Join | Joins together a series of strings (opposite of Split) |
Lcase | Converts a string to lowercase characters |
Left/LeftB | Returns the leftmost part of a string or byte array |
Len/LenB | Returns the length of a string or byte array |
LoadPicture | Loads a picture object |
Log | Returns the log of the argument |
LTrim | Removes leading spaces from a string |
Mid/MidB | Returns a substring from the middle of a string or byte array |
MsgBox | Displays a dialog box with a message |
Oct | Returns a string containing the octal value of a number |
Replace | Replaces one substring with another substring the specified number of times |
RGB | Returns a color based on values for red, green, and blue |
Right/RightB | Returns the rightmost part of a string or byte array |
Rnd | Returns the next random number from the random-number generator |
Round | Rounds a value to the specified number of decimal places |
Rtrim | Removes trailing spaces from a string |
Sgn | Returns –1 if the argument is negative, 0 if it’s zero, +1 if it’s positive |
Sin | Returns the sine of the argument |
Space | Fills a string with the specified number of spaces |
Split | Breaks apart a string into multiple strings based on a substring (opposite of Join) |
Sqr | Returns the square root of the argument |
StrComp | Compares strings |
String | Fills a string with a specified character the specified number of times |
StrReverse | Reverses the order of the characters in the string |
Tan | Returns the tangent of the argument |
Time | Returns the current time |
TimeSerial | Converts hour, minute, and second values to a Date value |
TimeValue | Returns the time part of a Date value |
Trim | Removes leading and trailing spaces from a string |
TypeName | Returns a string containing the name of the type of variable |
VarType | Returns an integer containing the type of variable |