分享
 
 
 

ASP的函数详解-2

王朝asp·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有