ASP函数大全文档格式.docx

上传人:b****5 文档编号:19411578 上传时间:2023-01-06 格式:DOCX 页数:11 大小:18.45KB
下载 相关 举报
ASP函数大全文档格式.docx_第1页
第1页 / 共11页
ASP函数大全文档格式.docx_第2页
第2页 / 共11页
ASP函数大全文档格式.docx_第3页
第3页 / 共11页
ASP函数大全文档格式.docx_第4页
第4页 / 共11页
ASP函数大全文档格式.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

ASP函数大全文档格式.docx

《ASP函数大全文档格式.docx》由会员分享,可在线阅读,更多相关《ASP函数大全文档格式.docx(11页珍藏版)》请在冰豆网上搜索。

ASP函数大全文档格式.docx

  response.writecINT(f)+2

236

  转化字符"

为数字"

,如果字符串为空,则返回0值

CreateObject()

建立和返回一个已注册的ACTIVEX组件的实例。

CreateObject(objName)

objName是任何一个有效、已注册的ACTIVEX组件的名字.

  Setcon=Server.CreateObject("

ADODB.Connection"

CStr()

转化一个表达式为字符串.

CStr(expression)

expression是任何有效的表达式。

  s=3+2

  response.write"

Theresultis:

"

&

cStr(s)

转化数字“5”为字符“5”。

Date()

返回当前系统日期.

Date()

None.

%=Date%[/IMG]

8/4/99

DateAdd()

返回一个被改变了的日期。

DateAdd(timeinterval,number,date)

timeintervalisthetimeintervaltoadd;

numberisamountoftimeintervalstoadd;

anddateisthestartingdate.

  currentDate=#8/4/99#

  newDate=DateAdd("

m"

3,currentDate)

  response.writenewDate

  <

  currentDate=#12:

34:

45PM#

h"

11/4/99

  3:

45PM

  "

="

month"

;

d"

day"

  IfcurrentDateisintimeformatthen,

hour"

s"

second"

DateDiff()

返回两个日期之间的差值。

DateDiff(timeinterval,date1,date2[,firstdayofweek[,firstweekofyear[/IMG][/IMG])

timeinterval表示相隔时间的类型,如“M“表示“月”。

  fromDate=#8/4/99#

  toDate=#1/1/2000#

Thereare"

_

  DateDiff("

fromDate,toDate)&

daystomilleniumfrom8/4/99."

从8/4/99到2000年还有150天.

Day()

返回一个月的第几日.

Day(date)

date是任何有效的日期。

%=Day(#8/4/99#)%[/IMG]

4

FormatCurrency()

返回表达式,此表达式已被格式化为货币值

FormatCurrency(Expression[,Digit[,LeadingDigit[,Paren[,GroupDigit[/IMG][/IMG][/IMG][/IMG])

Digit指示小数点右侧显示位数的数值。

默认值为-1,指示使用的是计算机的区域设置;

  LeadingDigit三态常数,指示是否显示小数值小数点前面的零。

%=FormatCurrency(34.3456)%[/IMG]

$34.35

FormatDateTime()

返回表达式,此表达式已被格式化为日期或时间

FormatDateTime(Date,[,NamedFormat[/IMG])

NamedFormat指示所使用的日期/时间格式的数值,如果省略,则使用vbGeneralDate.

%=FormatDateTime("

08/4/99"

vbLongDate)%[/IMG]

Wednesday,August04,1999

FormatNumber()

返回表达式,此表达式已被格式化为数值.

FormatNumber(Expression[,Digit[,LeadingDigit[,Paren[,GroupDigit[/IMG][/IMG][/IMG][/IMG])

默认值为-1,指示使用的是计算机的区域设置。

LeadingDigiti指示小数点右侧显示位数的数值。

Paren指示小数点右侧显示位数的数值。

GroupDigiti指示小数点右侧显示位数的数值。

.

%=FormatNumber(45.324567,3)%[/IMG]

45.325

FormatPercent()

返回表达式,此表达式已被格式化为尾随有%符号的百分比(乘以100)。

(%)

FormatPercent(Expression[,Digit[,LeadingDigit[,Paren[,GroupDigit[/IMG][/IMG][/IMG][/IMG])

同上.

%=FormatPercent(0.45267,3)%[/IMG]

45.267%

Hour()

以24时返回小时数.

Hour(time)

%=Hour(#4:

45:

34PM#)%[/IMG]

16

  (Hourhasbeenconvertedto24-hoursystem)

Instr()

返回字符或字符串在另一个字符串中第一次出现的位置.

Instr([start,[/IMG]strToBeSearched,strSearchFor[,compare[/IMG])

Start为搜索的起始值,strToBeSearched接受搜索的字符串strSearchFor要搜索的字符compare比较方式(详细见ASP常数)

  strText="

Thisisatest!

!

"

  pos=Instr(strText,"

a"

  response.writepos

9

InstrRev()

同上,只是从字符串的最后一个搜索起

InstrRev([start,[/IMG]strToBeSearched,strSearchFor[,compare[/IMG])

  pos=InstrRev(strText,"

13

Int()

返回数值类型,不四舍五入。

Int(number)

%=INT(32.89)%[/IMG]

32

IsArray()

判断一对象是否为数组,返回布尔值.

IsArray(name)

  strTest="

Test!

  response.writeIsArray(strTest)

False

IsDate()

判断一对象是否为日期,返回布尔值

IsDate(expression)

expressionisanyvalidexpression.

8/4/99"

  response.writeIsDate(strTest)

True

IsEmpty()

判断一对象是否初始化,返回布尔值.

IsEmpty(expression)

  Dimi

  response.writeIsEmpty(i)

IsNull()

判断一对象是否为空,返回布尔值.

IsNull(expression)

  response.writeIsNull(i)

  

  IsNumeric()

判断一对象是否为数字,返回布尔值.

IsNumeric(expression)

  i="

345"

  response.writeIsNumeric(i)

  就算数字加了引号,ASP还是认为它是数字。

IsObject()

判断一对象是否为对象,返回布尔值.

IsObject(expression)

  response.writeIsObject(con)

LBound()

返回指定数组维的最小可用下标.

Lbound(arrayname[,dimension[/IMG])

dimension指明要返回哪一维下界的整数。

使用1表示第一维,2表示第二维,以此类  推。

如果省略dimension参数,默认值为1.

  i=Array("

Tuesday"

Wednesday"

  response.writeLBound(i)

0

LCase()

返回字符串的小写形式

Lcase(string)

stringisanyvalidstringexpression.

  response.writeLCase(strTest)

thisisatest!

Left()

返回字符串左边第length个字符以前的字符(含第length个字符).

Left(string,length)

  response.writeLeft(strTest,3)

Thi

Len()

返回字符串的长度.

Len(string|varName)

  response.writeLen(strTest)

15

LTrim()

去掉字符串左边的空格.

LTrim(string)

Thisisatest!

  response.writeLTrim(strTest)

Mid()

返回特定长度的字符串(从start开始,长度为length).

Mid(string,start[,length[/IMG])

TodayisMonday."

  response.writeMid(strTest,17,5)

Today

Minute()

返回时间的分钏.

Minute(time)

%=Minute(#12:

32PM#)%[/IMG]

45

Month()

返回日期.

Month(date)

dateisanyvaliddateexpression.

%=Month(#08/04/99#)%[/IMG]

8

MonthName()

Returnsastringidentifyingthespecifiedmonth.

MonthName(month,[,Abb[/IMG])

monthisthenumericrepresentationforagivenmonth;

Abb(optional)isabooleanvalueusedtodisplaymonthabbreviation.TruewilldisplaytheabbreviatedmonthnameandFalse(default)willnotshowtheabbreviation.

%=MonthName(Month(#08/04/99#))%[/IMG]

August

Now()

Returnsthecurrentsystemdateandtime.

Now()

None

%=Now%[/IMG]

8/4/999:

30:

16AM

Replace()

Returnsastringinwhichaspecifiedsub-stringhasbeenreplacedwithanothersubstringaspecifiednumberoftimes.

Replace(strToBeSearched,strSearchFor,strReplaceWith[,start[,count[,compare[/IMG][/IMG][/IMG])

strToBeSearchedisastringexpressioncontainingasub-stringtobereplaced;

strSearchForisthestringexpressiontosearchforwithinstrToBeSearched;

strReplaceWithisthestringexpressiontoreplacesub-stringstrSearchFor;

start(optional)isthenumericcharacterpositiontobeginsearch;

count(optional)isavalueindicatingthecomparisionconstant.

Thisisanapple!

  response.writeReplace(strTest,"

apple"

"

orange"

Thisisanorange!

Right()

返回字符串右边第length个字符以前的字符(含第length个字符).

Right(string,length)

.

Thisisantest!

  response.writeRight(strTest,3)

st!

Rnd()

产生一个随机数.

Rnd[(number)[/IMG]

  Randomize()

  response.writeRND()

任何一个在0到1之间的数

Round()

返回按指定位数进行四舍五入的数值.

Round(expression[,numRight[/IMG])

numRight数字表明小数点右边有多少位进行四舍五入。

如果省略,则Round函数返回整数.

  i=32.45678

  response.writeRound(i)

Rtrim()

去掉字符串右边的字符串.

Rtrim(string)

  response.writeRTrim(strTest)

Second()

返回秒.

Second(time)

%=Second(#12:

28PM#)%[/IMG]

28

StrReverse()

反排一字符串

StrReverse(string)

  response.writeStrReverse(strTest)

!

tsetasisihT

Time()

返回系统时间.

Time()

%=Time%[/IMG]

9:

58:

28AM

Trim()

去掉字符串左右的空格.

Trim(string)

Thisisat

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1