Built-In Functions in VBScript
Some built-in functions are shown here in detail. The rest of the built-in functions are listed at the end of this document. It is only necessary to be aware that a function for a specific requirement actually exists. Descriptions of all these functions are available online or in more detailed reference manuals.
String Functions
| Function | Purpose |
|---|
| UCase | Converts to uppercase |
| LCase | Converts to lower case |
| Left | Extracts left (string, n) part of string for the first n characters from the left |
| Right | Extracts right (string, n) part of string for the first n characters from the right |
| Mid | Extracts mid (string, n1, n2) from n1 characters to n2 characters |
Math Functions
| Function | Purpose |
|---|
| Int | Truncates any value to an integer |
| Rnd | Produces a random number |
Date and Time Functions
| Function | Example |
|---|
| Now | 10/20/1999 01:33:48 AM |
| Date | 10/20/1999 |
| Time | 01:33:48 AM |
| Year | 1999 |
| Month | 10 |
| MonthName | October |
| Year | 1999 |
Dialog Boxes
There are a number of dialog boxes available.
- MsgBox (prompt [,buttons] [,title] [,helpfile],context] )
- InputBox (prompt [,buttons] [,title] [,helpfile],context] )
- return string = Prompt message, default value
- return value = Confirm (message string)
- alert or window.alert
MsgBox and InputBox Parameters
| Parameter | Purpose |
|---|
| buttons | A comma delimited list of the buttons that appear in the dialog box |
| title | Dialog box title |
| helpfile | Display the file name providing online help |
| context | Displays the context from which the user is accessing the help file |
MsgBox and InputBox Return Values
| Button | Return Value |
|---|
| vbOK | OK button clicked |
| vbCancel | Cancel button clicked |
| vbAbort | Abort button clicked |
| vbRetry | Retry button clicked |
| vbIgnore | Ignore button clicked |
| vbYes | Yes button clicked |
| vbNo | No button clicked |
VBScript Built-In Functions
- Abs
- Array
- Asc
- Atn
- CBool
- CByte
- CCur
- CDate
- CDbl
- Chr
- CInt
- CLng
- Cos
- CreateObject
- CSng
- CStr
- Date
- DateAddFunction
- DateDiff
- DatePart
- DateSerial
- DateValue
- Day
- Eval
- Exp
- Filter
- Fix
- FormatCurrency
- FormatDateTime
- FormatNumber
- FormatPercent
- GetObject
- GetRef
- Hex
- Hour
- InputBox
- InStr
- InStrRev
- Int
- IsArray
- IsDate
- IsEmpty
- IsNull
- IsNumeric
- IsObject
- Join
- LBound
- LCase
- Left
- Len
- LoadPicture
- Log
- LTrim
- Mid
- Minute
- Month
- MonthName
- MsgBox
- Now
- Oct
- Replace
- RGB
- Right
- Rnd
- Round
- RTrim
- ScriptEngine
- ScriptEngineBuildVersion
- ScriptEngineMajorVersion
- ScriptEngineMinorVersion
- Second
- Sgn
- Sin
- Space
- Split
- Sqr
- StrComp
- String
- StrReverse
- Tan
- Time
- Timer
- TimeSerial
- TimeValue
- Trim
- TypeName
- UBound
- UCase
- VarType
- Weekday
- WeekdayName
- Year