Sunteți pe pagina 1din 5

VBScript functions

A brief description of the functions available in VB Script. Abs(number) Returns the absolute value of a number. Array(arglist) Returns a Variant containing an array. Asc(string) Returns the ANSI character code corresponding to the first letter in a string. Atn(number) Returns the arctangent of a number. CBool(expression) Convert to a Variant of subtype Boolean. CByte(expression) Convert to a Variant of subtype Byte. CCur(expression) Convert to a Variant of subtype Currency. CDate(date) Convert to a Variant of subtype Date. CDbl(expression) Convert to a Variant of subtype Double. Chr(charcode) Returns the character associated with the specified ANSI character code. CInt(expression) Convert to a Variant of subtype Integer. CLng(expression) Convert to a Variant of subtype Long. Cos(number) Returns the cosine of an angle. CreateObject(servername.typename [, location]) Creates and returns a reference to an Automation object. CSng(expression) Convert to a Variant of subtype Single. CStr(expression) Convert to a Variant of subtype String. Date Returns the current system date. DateAdd(interval, number, date) Returns a date to which a specified time interval has been added. DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]]) Returns the number of intervals between two dates. DatePart(interval, date[, firstdayofweek[, firstweekofyear]]) Returns the specified part of a given date.

DateSerial(year, month, day) Returns a Variant of subtype Date for a specified year, month, and day. DateValue(date) Returns a Variant of subtype Date. Day(date) Returns a whole number between 1 and 31, inclusive, representing the day of the month. [result = ]Eval(expression) Evaluates an expression and returns the result. Exp(number) Returns e (the base of natural logarithms) raised to a power. Filter(InputStrings, Value[, Include[, Compare]]) Returns a zero-based array containing a subset of a string array based on a specified filter criteria. FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) Returns an expression formatted as the currency defined in the control panel. FormatDateTime(Date[, NamedFormat]) The NamedFormat argument may be (vbGeneralDate, vbLongDate, vbShortDate, vbLongTime, vbShortTime) Returns an expression formatted as a date or time. FormatNumber(Expression [,NumDigitsAfterDecimal [,GroupDigits]]]]) Returns an expression formatted as a number. [,IncludeLeadingDigit [,UseParensForNegativeNumbers

FormatPercent(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]) Returns an expression formatted as a percentage (multiplied by 100) with a trailing % character. GetLocale() Returns the current locale ID value. GetObject([pathname] [, class]) Returns a reference to an Automation object from a file. Set object.eventname = GetRef(procname) Returns a reference to a procedure that can be bound to an event. Hex(number) Returns a string representing the hexadecimal value of a number. Hour(time) Returns a whole number between 0 and 23, inclusive, representing the hour of the day. InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context]) Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box. InStr([start, ]string1, string2[, compare]) Returns the position of the first occurrence of one string within another. InStrRev(string1, string2[, start[, compare]]) Returns the position of an occurrence of one string within another, from the end of string. Int(number) Returns the integer portion of a number.

Fix(number) Returns the integer portion of a number. IsArray(varname) Returns a Boolean value indicating whether a variable is an array. IsDate(expression) Returns a Boolean value indicating whether an expression can be converted to a date. IsEmpty(expression) Returns a Boolean value indicating whether a variable has been initialized. IsNull(expression) Returns a Boolean value that indicates whether an expression contains no valid data (Null). IsNumeric(expression) Returns a Boolean value indicating whether an expression can be evaluated as a number. IsObject(expression) Returns a Boolean value indicating whether an expression references a valid Automation object. Join(list[, delimiter]) Returns a string created by joining a number of substrings contained in an array. LBound(arrayname[, dimension]) Returns the smallest available subscript for the indicated dimension of an array. LCase(string) Returns a string that has been converted to lowercase. Left(string, length) Returns a specified number of characters from the left side of a string. Len(string | varname) Returns the number of characters in a string or the number of bytes required to store a variable. LoadPicture(picturename) Returns a picture object. Available only on 32-bit platforms. Log(number) Returns the natural logarithm of a number. Mid(string, start[, length]) Returns a specified number of characters from a string. Minute(time) Returns a whole number between 0 and 59, inclusive, representing the minute of the hour. Month(date) Returns a whole number between 1 and 12, inclusive, representing the month of the year. MonthName(month[, abbreviate]) Returns a string indicating the specified month. MsgBox(prompt[, buttons][, title][, helpfile, context]) Displays a message in a dialog box, waits for the user to click a button, and returns a value indicating which button the user clicked. Now Returns the current date and time.

Oct(number) Returns a string representing the octal value of a number. Replace(expression, find, replacewith[, start[, count[, compare]]]) Returns a string in which a specified substring has been replaced with another substring a specified number of times. RGB(red, green, blue) Returns a whole number representing an RGB color value. Right(string, length) Returns a specified number of characters from the right side of a string. Rnd[(number)] Returns a random number. Round(expression[, numdecimalplaces]) Returns a number rounded to a specified number of decimal places. ScriptEngine Returns a string representing the scripting language in use (VBScript, Jscript, VBA). ScriptEngineBuildVersion Returns the build version number of the scripting engine in use. ScriptEngineMajorVersion Returns the major version number of the scripting engine in use. ScriptEngineMinorVersion Returns the minor version number of the scripting engine in use. Second(time) Returns a whole number between 0 and 59, inclusive, representing the second of the minute. SetLocale(lcid) Sets the global locale and returns the previous locale. Sgn(number) Returns an integer indicating the sign of a number. Sin(number) Returns the sine of an angle. Space(number) Returns a string consisting of the specified number of spaces. Split(expression[, delimiter[, count[, compare]]]) Returns a zero-based, one-dimensional array containing a specified number of substrings. Sqr(number) Returns the square root of a number. StrComp(string1, string2[, compare]) Returns a value indicating the result of a string comparison. String(number, character) Returns a repeating character string of the length specified. StrReverse(string1) Returns a string in which the character order of a specified string is reversed. Tan(number) Returns the tangent of an angle.

Time Returns a Variant of subtype Date indicating the current system time. Timer Returns the number of seconds that have elapsed since 12:00 AM (midnight). TimeSerial(hour, minute, second) Returns a Variant of subtype Date containing the time for a specific hour, minute, and second. TimeValue(time) Returns a Variant of subtype Date containing the time. Trim(string) LTrim(string) RTrim(string) Returns a copy of a string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim). TypeName(varname) Returns a string that provides Variant subtype information about a variable. UBound(arrayname[, dimension]) Returns the largest available subscript for the indicated dimension of an array. UCase(string) Returns a string that has been converted to uppercase. VarType(varname) Returns a value indicating the subtype of a variable. Weekday(date, [firstdayofweek]) Returns a whole number representing the day of the week (Sun=1 Sat=7). WeekdayName(weekday, abbreviate, firstdayofweek) Returns a string indicating the specified day of the week. Year(date) Returns a whole number representing the year.

S-ar putea să vă placă și