当前位置: 首页 > 网络学院 > 客户端脚本教程 > VBScript > VBScript 函数
This page contains all the built-in VBScript functions. The page is divided into following sections:
这页有VBScript所内置的所有函数。页面的内容可以划分为以下几个部分:
| 函数名 | 描述 |
|---|---|
| CDate | Converts a valid date and time expression to the variant of subtype Date 返回表达式,此表达式已被转换为 Date 子类型的 Variant |
| Date | 返回当前系统日期。 |
| DateAdd | 返回已添加指定时间间隔的日期。 |
| DateDiff | 返回两个日期之间的时间间隔。 |
| DatePart | 返回给定日期的指定部分。 |
| DateSerial | Returns the date for a specified year, month, and day 返回指定的年,月,日 |
| DateValue | Returns a date 返回日期 |
| Day | Returns a number that represents the day of the month (between 1 and 31, inclusive) 返回日期中的日(在1与31之间,包含) |
| FormatDateTime | Returns an expression formatted as a date or time 返回格式化后的日期或是时间 |
| Hour | Returns a number that represents the hour of the day (between 0 and 23, inclusive) 返回时间里的小时(在0和23之间,包含) |
| IsDate | Returns a Boolean value that indicates if the evaluated expression can be converted to a date 返回一个布耳值,判断当前表达式里的值是否可以转换成日期 |
| Minute | Returns a number that represents the minute of the hour (between 0 and 59, inclusive) 返回时间里的分钟(在0到59之间,包含) |
| Month | Returns a number that represents the month of the year (between 1 and 12, inclusive) 返回日期里的月份(在1和12之间,包含) |
| MonthName | Returns the name of a specified month 返回指定月份的名称 |
| Now | Returns the current system date and time 返回当前系统的日期与时间 |
| Second | Returns a number that represents the second of the minute (between 0 and 59, inclusive) 返回时间里的秒(在0和59之间,包含) |
| Time | Returns the current system time 返回当前系统时间 |
| Timer | Returns the number of seconds since 12:00 AM 返回从午夜12点到指定时间之间的总秒数 |
| TimeSerial | Returns the time for a specific hour, minute, and second 返回针对小时,分钟以及秒的时间 |
| TimeValue | Returns a time 返回时间 |
| Weekday | Returns a number that represents the day of the week (between 1 and 7, inclusive) 返回星期几(从1到7,包含) |
| WeekdayName | Returns the weekday name of a specified day of the week 返回指定日期的星期名称 |
| Year | Returns a number that represents the year 返回日期中的年份 |
转换函数 | Top |
| 函数名 | 描述 |
|---|---|
| Asc | 返回与字符串的第一个字母对应的 ANSI 字符代码 |
| CBool | Converts an expression to a variant of subtype Boolean 返回表达式,此表达式已转换为 Boolean 子类型的 Variant。 |
| CByte | Converts an expression to a variant of subtype Byte 返回表达式,此表达式已被转换为 Byte 子类型的 Variant |
| CCur | Converts an expression to a variant of subtype Currency 返回表达式,此表达式已被转换为 Currency 子类型的 Variant |
| CDate | Converts a valid date and time expression to the variant of subtype Date 返回表达式,此表达式已被转换为 Date 子类型的 Variant |
| CDbl | Converts an expression to a variant of subtype Double 返回表达式,此表达式已被转换为 Double 子类型的 Variant |
| Chr | Converts the specified ANSI code to a character 返回与指定的 ANSI 字符代码相对应的字符。 |
| CInt | Converts an expression to a variant of subtype Integer 返回表达式,此表达式已被转换为 Integer 子类型的 Variant |
| CLng | Converts an expression to a variant of subtype Long 返回表达式,此表达式已被转换为 Long 子类型的 Variant |
| CSng | Converts an expression to a variant of subtype Single 返回表达式,该表达式已被转换为 Single 子类型的 Variant |
| CStr | Converts an expression to a variant of subtype String 返回表达式,该表达式已被转换为 String 子类型的 Variant |
| Hex | Returns the hexadecimal value of a specified number 返回表示十六进制数字值的字符串。 |
| Oct | Returns the octal value of a specified number 返回表示数字八进制值的字符串 |
格式化函数 | Top |
| 函数名 | 描述 |
|---|---|
| FormatCurrency | Returns an expression formatted as a currency value 返回表达式,此表达式已被格式化为货币值(使用系统控制面板中定义的货币符号)。 |
| FormatDateTime | Returns an expression formatted as a date or time 返回表达式,此表达式已被格式化为日期或时间 |
| FormatNumber | Returns an expression formatted as a number 返回表达式,此表达式已被格式化为数值。 |
| FormatPercent | Returns an expression formatted as a percentage 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 |
计算函数 | Top |
| 函数名 | 描述 |
|---|---|
| Abs | Returns the absolute value of a specified number 返回数字的绝对值。 |
| Atn | Returns the arctangent of a specified number 返回数值的反正切值。 |
| Cos | Returns the cosine of a specified number (angle) 返回某个角的余弦值。 |
| Exp | Returns e raised to a power 返回 e(自然对数的底)的幂次方。 |
| Hex | Returns the hexadecimal value of a specified number 返回表示十六进制数字值的字符串。 |
| Int | Returns the integer part of a specified number 返回数字的整数部分 |
| Fix | Returns the integer part of a specified number 返回数字的整数部分。 |
| Log | Returns the natural logarithm of a specified number 返回数值的自然对数。 |
| Oct | Returns the octal value of a specified number 返回表示数字八进制值的字符串。 |
| Rnd | Returns a random number less than 1 but greater or equal to 0 返回一个小于1或大于等于0的随机数。 |
| Sgn | Returns an integer that indicates the sign of a specified number 返回表示数字符号的整数。 |
| Sin | Returns the sine of a specified number (angle) 返回某个角的正弦值。 |
| Sqr | Returns the square root of a specified number 返回数值的平方根。 |
| Tan | Returns the tangent of a specified number (angle) 返回某个角的正切值。 |
数组函数 | Top |
| 函数名 | 描述 |
|---|---|
| Array | Returns a variant containing an array 返回包含数组的 Variant。 |
| Filter | Returns a zero-based array that contains a subset of a string array based on a filter criteria 返回下标从零开始的 数组,其中包含以特定过滤条件为基础的字符串数组的子集。 |
| IsArray | Returns a Boolean value that indicates whether a specified variable is an array 返回 Boolean 值指明某变量是否为数组。 |
| Join | Returns a string that consists of a number of substrings in an array 返回一个字符串,此字符串由包含在数组中的许多子字符串联接创建。 |
| LBound | Returns the smallest subscript for the indicated dimension of an array 返回指定数组维的最小可用下标。 |
| Split | Returns a zero-based, one-dimensional array that contains a specified number of substrings 返回基于 0 的一维数组,其中包含指定数目的子字符串。 |
| UBound | Returns the largest subscript for the indicated dimension of an array 返回指定数组维数的最大可用下标。 |
字符串函数 | Top |
| 函数名 | 描述 |
|---|---|
| InStr | Returns the position of the first occurrence of one string within another. The search begins at the first character of the string 返回某字符串在另一字符串中第一次出现的位置。 |
| InStrRev | Returns the position of the first occurrence of one string within another. The search begins at the last character of the string 返回某字符串在另一个字符串中出现的从结尾计起的位置。 |
| LCase | Converts a specified string to lowercase 返回字符串的小写形式。 |
| Left | Returns a specified number of characters from the left side of a string 返回指定数目的从字符串的左边算起的字符 |
| Len | Returns the number of characters in a string 返回字符串内字符的数目,或是存储一变量所需的字节数。 |
| LTrim | Removes spaces on the left side of a string 返回不带前导空格 (LTrim) 的字符串副本。 |
| RTrim | Removes spaces on the right side of a string 返回不带后续空格 (RTrim) 的字符串副本。 |
| Trim | Removes spaces on both the left and the right side of a string 返回不带前导与后续空格 (Trim) 的字符串副本。 |
| Mid | Returns a specified number of characters from a string 从字符串中返回指定数目的字符。 |
| Replace | Replaces a specified part of a string with another string a specified number of times 返回字符串,其中指定数目的某子字符串被替换为另一个子字符串 |
| Right | Returns a specified number of characters from the right side of a string 从字符串右边返回指定数目的字符 |
| Space | Returns a string that consists of a specified number of spaces 返回由指定数目的空格组成的字符串。 |
| StrComp | Compares two strings and returns a value that represents the result of the comparison 返回一个表明字符串比较结果的值。 |
| String | Returns a string that contains a repeating character of a specified length 返回具有指定长度的、重复字符组成的字符串 |
| StrReverse | Reverses a string 返回字符串,此字符串与指定字符串顺序相反 |
| UCase | Converts a specified string to uppercase 返回字符串的大写形式。 |
其它函数 | Top |
| 函数名 | 描述 |
|---|---|
| CreateObject | Creates an object of a specified type 创建一个指定类型的对象 |
| Eval | Evaluates an expression and returns the result 计算一个表达式的值并返回结果。 |
| GetLocale | Returns the current locale ID 返回当前的区域设置 ID 值。 |
| GetObject | Returns a reference to an automation object from a file 返回对文件中 Automation 对象的引用 |
| GetRef | Allows you to connect a VBScript procedure to a DHTML event on your pages 返回一个指向一过程的引用,此过程可绑定某事件 |
| InputBox | Displays a dialog box, where the user can write some input and/or click on a button, and returns the contents 在对话框中显示提示,等待用户输入文本或单击按钮,并返回文本框内容。 |
| IsEmpty | Returns a Boolean value that indicates whether a specified variable has been initialized or not 返回 Boolean 值指明变量是否已初始化 |
| IsNull | Returns a Boolean value that indicates whether a specified expression contains no valid data (Null) 返回 Boolean 值,指明表达式是否不包含任何有效数据 (Null)。 |
| IsNumeric | Returns a Boolean value that indicates whether a specified expression can be evaluated as a number 返回 Boolean 值指明表达式的值是否为数字。 |
| IsObject | Returns a Boolean value that indicates whether the specified expression is an automation object 返回 Boolean 值指明表达式是否引用了有效的 Automation 对象。 |
| LoadPicture | Returns a picture object. Available only on 32-bit platforms 返回图片对象。 |
| MsgBox | Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked 在对话框中显示消息,等待用户单击按钮,并返回一个值指示用户单击的按钮。 |
| RGB | Returns a number that represents an RGB color value 返回代表 RGB 颜色值的整数。 |
| Round | Rounds a number 返回按指定位数进行四舍五入的数值。 |
| ScriptEngine | Returns the scripting language in use 返回一个代表当前使用的脚本程序语言的字符串。 |
| 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 返回使用的编写引擎引擎的次版本号。 |
| SetLocale | Sets the locale ID and returns the previous locale ID 设置全局区域设置并返回原有的区域设置。 |
| TypeName | Returns the subtype of a specified variable 返回一个字符串,提供有关变量的 Variant 子类型信息。 |
| VarType | Returns a value that indicates the subtype of a specified variable 返回指示变量子类型的值。 |
评论 (0) All