ASP函数大全
ASP函数大全
Array()
FUNCTION: 返回一个数组
SYNTAX:
Array(list)
ARGUMENTS:
字符,数字均可
EXAMPLE: <%
Dim
myArray()
For
i = 1 to 7
Redim
Preserve myArray(i)
myArray(i)
= WeekdayName(i)
Next
%>
RESULT: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday",
... ... "Saturday")
CInt()
FUNCTION: 将一个表达式转化为数字类型
SYNTAX:
CInt(expression)
ARGUMENTS:
任何有效的字符均可
EXAMPLE: <%
f
= "234"
response.write
cINT(f) + 2
%>
RESULT:
236
转化字符"234"为数字"234",如果字符串为空,则返回0值
CreateObject()
FUNCTION: 建立和返回一个已注册的ACTIVEX组件的实例。
SYNTAX:
CreateObject(objName)
ARGUMENTS:
objName 是任何一个有效、已注册的ACTIVEX组件的名字.
EXAMPLE: <%
Set
con = Server.CreateObject("ADODB.Connection")
%>
RESULT:
CStr()
FUNCTION: 转化一个表达式为字符串.
SYNTAX:
CStr(expression)
ARGUMENTS:
expression 是任何有效的表达式。
EXAMPLE: <%
s
= 3 + 2
response.write
"The result is: " & cStr(s)
%>
RESULT: 转化数字“5”为字符“5”。
Date()
FUNCTION: 返回当前系统日期.
SYNTAX:
Date()
ARGUMENTS:
None.
EXAMPLE: <%=Date%>
RESULT:
8/4/99
DateAdd()
FUNCTION: 返回一个被改变了的日期。
SYNTAX: DateAdd(timeinterval,number,date)
ARGUMENTS:
timeinterval is the time interval to add; number is amount of time intervals to
add; and date is the starting date.
EXAMPLE: <%
currentDate
= #8/4/99#
newDate
= DateAdd("m",3,currentDate)
response.write
newDate
%>
<%
currentDate
= #12:34:45 PM#
newDate
= DateAdd("h",3,currentDate)
response.write
newDate
%>
RESULT:
11/4/99
3:34:45 PM
"m"
= "month";
"d"
= "day";
If
currentDate is in time format then,
"h"
= "hour";
"s"
= "second";
DateDiff()
FUNCTION: 返回两个日期之间的差值 。
SYNTAX:
DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear>>)
ARGUMENTS:
timeinterval 表示相隔时间的类型,如“M“表示“月”。
EXAMPLE: <%
fromDate
= #8/4/99#
toDate
= #1/1/2000#
response.write
"There are " & _
DateDiff("d",fromDate,toDate)
& _
"
days to millenium from 8/4/99."
%>
RESULT: 从8/4/99 到2000年还有 150 天.
Day()
FUNCTION: 返回一个月的第几日 .
SYNTAX:
Day(date)
ARGUMENTS:
date 是任何有效的日期。
EXAMPLE: <%=Day(#8/4/99#)%>
RESULT: 4
FormatCurrency()
FUNCTION: 返回表达式,此表达式已被格式化为货币值
SYNTAX:
FormatCurrency(Expression [, Digit [, LeadingDigit [, Paren [,
GroupDigit>>>>)
ARGUMENTS:
Digit 指示小数点右侧显示位数的数值。默认值为
-1,指示使用的是计算机的区域设置;
LeadingDigit
三态常数,指示是否显示小数值小数点前面的零。
EXAMPLE: <%=FormatCurrency(34.3456)%>
RESULT:
$34.35
FormatDateTime()
FUNCTION: 返回表达式,此表达式已被格式化为日期或时间
SYNTAX:
FormatDateTime(Date, [, NamedFormat>)
ARGUMENTS:
NamedFormat 指示所使用的日期/时间格式的数值,如果省略,则使用
vbGeneralDate.
EXAMPLE: <%=FormatDateTime("08/4/99",
vbLongDate)%>
RESULT:
Wednesday, August 04, 1999
FormatNumber()
FUNCTION: 返回表达式,此表达式已被格式化为数值.
SYNTAX:
FormatNumber(Expression [, Digit [, LeadingDigit [, Paren [,
GroupDigit>>>>)
ARGUMENTS:
Digit 指示小数点右侧显示位数的数值。默认值为
-1,指示使用的是计算机的区域设置。;
LeadingDigit i指示小数点右侧显示位数的数值。默认值为
-1,指示使用的是计算机的区域设置。;
Paren 指示小数点右侧显示位数的数值。默认值为
-1,指示使用的是计算机的区域设置。;
GroupDigit i指示小数点右侧显示位数的数值。默认值为
-1,指示使用的是计算机的区域设置。.
EXAMPLE: <%=FormatNumber(45.324567,
3)%>
RESULT:
45.325
FormatPercent()
FUNCTION: 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
SYNTAX:
FormatPercent(Expression [, Digit [, LeadingDigit [, Paren [,
GroupDigit>>>>)
ARGUMENTS:
同上.
EXAMPLE: <%=FormatPercent(0.45267,
3)%>
RESULT:
45.267%
Hour()
FUNCTION: 以24时返回小时数.
SYNTAX:
Hour(time)
ARGUMENTS:
EXAMPLE: <%=Hour(#4:45:34
PM#)%>
RESULT: 16
(Hour has
been converted to 24-hour system)
Instr()
FUNCTION: 返回字符或字符串在另一个字符串中第一次出现的位置.
SYNTAX:
Instr([start, > strToBeSearched, strSearchFor [, compare>)
ARGUMENTS:
Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符compare 比较方式(详细见ASP常数)
EXAMPLE: <%
strText
= "This is a test!!"
pos
= Instr(strText, "a")
response.write
pos
%>
RESULT: 9
InstrRev()
FUNCTION: 同上,只是从字符串的最后一个搜索起
SYNTAX:
InstrRev([start, > strToBeSearched, strSearchFor [, compare>)
ARGUMENTS:
同上.
EXAMPLE: <%
strText
= "This is a test!!"
pos
= InstrRev(strText, "s")
response.write
pos
%>
RESULT: 13
Int()
FUNCTION: 返回数值类型,不四舍五入。
SYNTAX:
Int(number)
ARGUMENTS:
EXAMPLE: <%=INT(32.89)%>
RESULT: 32
IsArray()
FUNCTION: 判断一对象是否为数组,返回布尔值 .
SYNTAX: IsArray(name)
ARGUMENTS:
EXAMPLE: <%
strTest
= "Test!"
response.write
IsArray(strTest)
%>
RESULT:
False
IsDate()
FUNCTION: 判断一对象是否为日期,返回布尔值
SYNTAX:
IsDate(expression)
ARGUMENTS:
expression is any valid expression.
EXAMPLE: <%
strTest
= "8/4/99"
response.write
IsDate(strTest)
%>
RESULT:
True
IsEmpty()
FUNCTION: 判断一对象是否初始化,返回布尔值.
SYNTAX:
IsEmpty(expression)
ARGUMENTS:
EXAMPLE: <%
Dim
i
response.write
IsEmpty(i)
%>
RESULT:
True
IsNull()
FUNCTION: 判断一对象是否为空,返回布尔值.
SYNTAX:
IsNull(expression)
ARGUMENTS:
EXAMPLE: <%
Dim
i
response.write
IsNull(i)
%>
RESULT:
False
IsNumeric()
FUNCTION: 判断一对象是否为数字,返回布尔值.
SYNTAX:
IsNumeric(expression)
ARGUMENTS:
EXAMPLE: <%
i
= "345"
response.write
IsNumeric(i)
%>
RESULT:
True
就算数字加了引号,ASP还是认为它是数字。
IsObject()
FUNCTION: 判断一对象是否为对象,返回布尔值.
SYNTAX:
IsObject(expression)
ARGUMENTS:
EXAMPLE: <%
Set
con = Server.CreateObject("ADODB.Connection")
response.write
IsObject(con)
%>
RESULT:
True
LBound()
FUNCTION: 返回指定数组维的最小可用下标.
SYNTAX:
Lbound(arrayname [, dimension>)
ARGUMENTS:
dimension 指明要返回哪一维下界的整数。使用
1 表示第一维,2 表示第二维,以此类推。如果省略 dimension
参数,默认值为 1.
EXAMPLE: <%
i
= Array("Monday","Tuesday","Wednesday")
response.write
LBound(i)
%>
RESULT: 0
LCase()
FUNCTION: 返回字符串的小写形式
SYNTAX:
Lcase(string)
ARGUMENTS:
string is any valid string expression.
EXAMPLE: <%
strTest
= "This is a test!"
response.write
LCase(strTest)
%>
RESULT:
this is a test!
Left()
FUNCTION: 返回字符串左边第length个字符以前的字符(含第length个字符).
SYNTAX:
Left(string, length)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test!"
response.write
Left(strTest, 3)
%>
RESULT:
Thi
Len()
FUNCTION: 返回字符串的长度.
SYNTAX:
Len(string | varName)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test!"
response.write
Len(strTest)
%>
RESULT: 15
LTrim()
FUNCTION: 去掉字符串左边的空格.
SYNTAX:
LTrim(string)
ARGUMENTS:
EXAMPLE: <%
strTest
= " This is a test!"
response.write
LTrim(strTest)
%>
RESULT:
This is a test!
Mid()
FUNCTION: 返回特定长度的字符串(从start开始,长度为length).
SYNTAX:
Mid(string, start [, length>)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test! Today is Monday."
response.write
Mid(strTest, 17, 5)
%>
RESULT:
Today
Minute()
FUNCTION: 返回时间的分钏.
SYNTAX:
Minute(time)
ARGUMENTS:
EXAMPLE: <%=Minute(#12:45:32
PM#)%>
RESULT: 45
Month()
FUNCTION: 返回日期.
SYNTAX:
Month(date)
ARGUMENTS:
date is any valid date expression.
EXAMPLE: <%=Month(#08/04/99#)%>
RESULT: 8
MonthName()
FUNCTION:
Returns a string identifying the specified month.
SYNTAX:
MonthName(month, [, Abb>)
ARGUMENTS:
month is the numeric representation for a given month; Abb (optional) is a
boolean value used to display month abbreviation. True will display the
abbreviated month name and False (default) will not show the abbreviation.
EXAMPLE: <%=MonthName(Month(#08/04/99#))%>
RESULT:
August
Now()
FUNCTION:
Returns the current system date and time.
SYNTAX:
Now()
ARGUMENTS:
None
EXAMPLE: <%=Now%>
RESULT:
8/4/99 9:30:16 AM
Replace()
FUNCTION:
Returns a string in which a specified sub-string has been replaced with another
substring a specified number of times.
SYNTAX:
Replace(strToBeSearched, strSearchFor, strReplaceWith [, start [, count [,
compare>>>)
ARGUMENTS:
strToBeSearched is a string expression containing a sub-string to be replaced;
strSearchFor is the string expression to search for within strToBeSearched;
strReplaceWith is the string expression to replace sub-string strSearchFor;
start (optional) is the numeric character position to begin search; count
(optional) is a value indicating the comparision constant.
EXAMPLE: <%
strTest
= "This is an apple!"
response.write
Replace(strTest, "apple", "orange")
%>
RESULT:
This is an orange!
Right()
FUNCTION: 返回字符串右边第length个字符以前的字符(含第length个字符).
SYNTAX:
Right(string, length)
ARGUMENTS:
.
EXAMPLE: <%
strTest
= "This is an test!"
response.write
Right(strTest, 3)
%>
RESULT:
st!
Rnd()
FUNCTION: 产生一个随机数.
SYNTAX:
Rnd [ (number) >
ARGUMENTS:
EXAMPLE: <%
Randomize()
response.write
RND()
%>
RESULT: 任何一个在0 到 1 之间的数
Round()
FUNCTION: 返回按指定位数进行四舍五入的数值.
SYNTAX:
Round(expression [, numRight>)
ARGUMENTS:
numRight数字表明小数点右边有多少位进行四舍五入。如果省略,则
Round 函数返回整数.
EXAMPLE: <%
i
= 32.45678
response.write
Round(i)
%>
RESULT: 32
Rtrim()
FUNCTION: 去掉字符串右边的字符串.
SYNTAX:
Rtrim(string)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test!! "
response.write
RTrim(strTest)
%>
RESULT:
This is a test!!
Second()
FUNCTION: 返回秒.
SYNTAX:
Second(time)
ARGUMENTS:
.
EXAMPLE: <%=Second(#12:34:28
PM#)%>
RESULT: 28
StrReverse()
FUNCTION: 反排一字符串
SYNTAX:
StrReverse(string)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test!!"
response.write
StrReverse(strTest)
%>
RESULT:
!!tset a si sihT
Time()
FUNCTION: 返回系统时间.
SYNTAX:
Time()
ARGUMENTS:
.
EXAMPLE: <%=Time%>
RESULT:
9:58:28 AM
Trim()
FUNCTION: 去掉字符串左右的空格.
SYNTAX:
Trim(string)
ARGUMENTS:
string is any valid string expression.
EXAMPLE: <%
strTest
= " This is a test!! "
response.write
Trim(strTest)
%>
RESULT:
This is a test!!
UBound()
FUNCTION: 返回指定数组维数的最大可用下标.
SYNTAX:
Ubound(arrayname [, dimension>)
ARGUMENTS:
dimension (optional) 指定返回哪一维上界的整数。1
表示第一维,2 表示第二维,以此类推。如果省略 dimension
参数,则默认值为
1.
EXAMPLE: <%
i
= Array("Monday","Tuesday","Wednesday")
response.write
UBound(i)
%>
RESULT: 2
UCase()
FUNCTION: 返回字符串的大写形式.
SYNTAX:
UCase(string)
ARGUMENTS:
EXAMPLE: <%
strTest
= "This is a test!!"
response.write
UCase(strTest)
%>
RESULT:
THIS IS A TEST!!
VarType()
FUNCTION: 返回指示变量子类型的值
SYNTAX:
VarType(varName)
ARGUMENTS:
EXAMPLE: <%
i
= 3
response.write
varType(i)
%>
RESULT: 2(数字)详见"asp常数"
WeekDay()
FUNCTION: 返回在一周的第几天.
SYNTAX:
WeekDay(date [, firstdayofweek>)
ARGUMENTS:
.
EXAMPLE: <%
d
= #8/4/99#
response.write
Weekday(d)
%>
RESULT: 4(星期三)
WeekDayName()
FUNCTION: 返回一周第几天的名字.
SYNTAX:
WeekDayName(weekday [, Abb [, firstdayofweek>>)
ARGUMENTS:
Abb可选。Boolean 值,指明是否缩写表示星期各天的名称。如果省略, 默认值为 False,即不缩写星期各天的名称.firstdayofweek指明星期第一天的数值
EXAMPLE: <%
d
= #8/4/99#
response.write
WeekdayName(Weekday(d))
%>
RESULT:
Wednesday
Year()
FUNCTION: 返回当前的年份.
SYNTAX:
Year(date)
ARGUMENTS:
EXAMPLE: <%=Year(#8/4/99#)%>
RESULT:
1999
ASP函数大全的更多相关文章
- 转:Delphi 函数大全
Delphi 函数大全 - xiucaiyao的专栏 - 博客频道 - CSDN.NEThttp://blog.csdn.net/xiucaiyao/article/details/4544039 名 ...
- SQL-2008函数大全
SQL Server 2008 函数大全(完整版) SQL2008 表达式:是常量.变量.列或函数等与运算符的任意组合.1. 字符串函数 函数 名称 参数 示例 说明 ascii(字符串表达式) se ...
- PB函数大全
PB函数大全 Abs()功能计算绝对值.语法Abs ( n )参数n:要得到绝对值的数值型变量或表达式返回值返回值的数据类型与n的数据类型相同,函数执行成功时返回n的绝对值.如果参数n的值为NULL, ...
- orale 函数大全[转]
oracle函数大全 http://wenku.baidu.com/link?url=bXaGsnn8iN264GB8ec48IUPg5eRGDKAyAiSw0OBKL1I0mBVG549-2u9HT ...
- Oracle日期时间函数大全
ORACLE日期时间函数大全 TO_DATE格式(以时间:2007-11-02 13:45:25为例) Year: yy two digits 两位年 显示值:07 yyy three digits ...
- MySQL 函数大全
mysql函数大全 对于针对字符串位置的操作,第一个位置被标记为1. ASCII(str) 返回字符串str的最左面字符的ASCII代码值.如果str是空字符串,返回0.如果str是NULL,返回NU ...
- MySQL日期时间函数大全(转)
MySQL日期时间函数大全 DAYOFWEEK(date) 返回日期date是星期几(1=星期天,2=星期一,……7=星期六,ODBC标准)mysql> select DAYOFWEEK('1 ...
- SqlServer 函数 大全
sql server使用convert来取得datetime日期数据 sql server使用convert来取得datetime日期数据,以下实例包含各种日期格式的转换 语句及查询结果: Selec ...
- SQL SERVER 2008函数大全(含例子)
--SQL SERVER 2008 函数大全 /* author:TracyLee csdncount:Travylee */ /* 一.字符串函数: 1.ascii(字符串表达式) 返回字符串 ...
随机推荐
- Linux 系统结构
Linux的系统结构一般由四部分组成 内核 1)内核 操作系统的核心,具有最基本的功能:内存管理.进程管理.设备驱动管理.文件系统管理,网络管理 内核版本(kernel)查看的三种方法 cat /pr ...
- Java基础(49):快速排序的Java封装(含原理,完整可运行,结合VisualGo网站更好理解)
快速排序 对冒泡排序的一种改进,若初始记录序列按关键字有序或基本有序,蜕化为冒泡排序.使用的是递归原理,在所有同数量级O(n longn) 的排序方法中,其平均性能最好.就平均时间而言,是目前被认为最 ...
- JSP里比对单选框或复选框的数值而自动打勾
<table> <tr> <td class="tableleft">状态</td> <td><input typ ...
- SQL Server XML基础学习之<7>--XML modify() 方法对 XML 数据中插入、更新或删除
/*------------------------------------------------------------------------------+ #| = : = : = : = : ...
- MVC4中下拉菜单和单选框的简单设计方法
举例一: @Html.LabelFor(model => model.Gender) @Html.DropDownListFor(model => model.Gender, new[] ...
- js 去除空格
var MAX_PERIOD = $('#MAX_PERIOD').val(); // 借款的最大期限 MAX_PERIOD=Trim(MAX_PERIOD,"g"); //带 ...
- 夺命雷公狗ThinkPHP项目之----企业网站9之栏目的列表完善(无限极分类的完成)
我们刚才已经写好model了,那么这里直接来调用下他即可: public function lists(){ $mod = D('Category')->catTree(); $this -&g ...
- 夺命雷公狗---TP商城----TP之样式和特效以及图片引入---2
---恢复内容开始--- 刚才见到笑脸了,那么下一步就到我们的shop目录下创建一个Admin的目录了,然后将Home目录里面的东西全部都拉进去即可 然后我们回到shop\Home\View目录下创建 ...
- [经典php视频]构建正则表达式解析网页中的图像标记<img>
这是高洛峰php视频中的一段,视频中一边分析需要的功能,一边构建greg_match函数的参数,边讲解边实战,是非常好的一种构建功能的演示. 你不可能把浩瀚的IT资料都记在脑袋里,也不可能随时随地透过 ...
- 【fedora】制作安装u盘
找一台安装好linux系统的PC,将下载的LiveCD ISO文件复制到硬盘(这样速度快),查看U盘挂载的位置(用磁盘工具),在终端中使用dd命令: $ sudo dd if=<Live ISO ...