21. isobject()
function: returns a boolean value indicating whether an expression refers to an automation object.
syntax: isobject(expression)
arguments: expression is any valid expression.
example: <%
set con = server.createobject(“adodb.connection”)
response.write isobject(con)
%>
result: true
————————————-
22. lbound()
function: returns the base index value for a dimension of any array.
syntax: lbound(arrayname [, dimension])
arguments: arrayname is the name of any array; dimension is an optional number indicating the dimension
to find the lower bound.
example: <%
i = array(“monday”,”tuesday”,”wednesday”)
response.write lbound(i)
%>
result: 0
————————————-
23. lcase()
function: returns a string that has been converted into lowercase characters.
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!
————————————-
24. left()
function: returns the number of characters from the left side of a string.
syntax: left(string, length)
arguments: string is any valid string expression; length is the length of characters to return.
example: <%
strtest = “this is a test!”
response.write left(strtest, 3)
%>
result: thi
————————————-
25. len()
function: returns the number of characters in a string or the number of bytes required to store a
variable.
syntax: len(string | varname)
arguments: string is any valid string expression; varname is any valid variable name.
example: <%
strtest = “this is a test!”
response.write len(strtest)
%>
result: 15
(the total length of strtest is 15 characters)
26.
ltrim()
function: returns a string without leading spaces.
syntax: ltrim(string)
arguments: string is any valid string expression.
example: <%
strtest = ” this is a test!”
response.write ltrim(strtest)
%>
result: this is a test!
————————————-
27. mid()
function: returns a specified number of characters from a string.
syntax: mid(string, start [, length])
arguments: string is any valid string expression; start is a numeric character position to begin
extraction from; length (optional) is the number of characters to return.
example: <%
strtest = “this is a test! today is monday.”
response.write mid(strtest, 17, 5)
%>
result: today
————————————-
28. minute()
function: returns the number of the minutes in current system time.
syntax: minute(time)
arguments: time is any valid time expression.
example: <%=minute(#12:45:32 pm#)%>
result: 45
————————————-
29. month()
function: returns the number of the month of the year.
syntax: month(date)
arguments: date is any valid date expression.
example: <%=month(#08/04/99#)%>
result: 8
————————————-
30. 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
————————————-
31. now()
function: returns the current system date and time.
syntax: now()
arguments: none
example: <%=now%>
result: 8/4/99 9:30:16 am
————————————-
32. 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!
————————————-
33. right()
function: returns a specified number of characters from the right side of a string.
syntax: right(string, length)
arguments: string is any valid string expression; length is any valid numeric expression representing
the number of characters to return.
example: <%
strtest = “this is an test!”
response.write right(strtest, 3)
%>
result: st!
————————————-
34. rnd()
function: returns a random number.
syntax: rnd [ (number) ]
arguments: number is any valid numeric expression.
example: <%
randomize()
response.write rnd()
%>
result: any number between 0 and 1
(without randomize(), the number will not re-generate)
round()
function: returns a number rounded to a specified number of decimal places.
syntax: round(expression [, numright])
arguments: expression is any valid numeric expression to be rounded; numright (optional) is any numeric
expression used to indicate the number of digits to the right of the decimal point.
example: <%
i = 32.45678
response.write round(i)
%>
result: 32
————————————-
35. rtrim()
function: returns a copy of a string without trailing spaces.
syntax: rtrim(string)
arguments: string is any valid string expression.
example: <%
strtest = “this is a test!! “
response.write rtrim(strtest)
%>
result: this is a test!!
————————————-
36. second()
function: returns the current seconds value of the current system time.
syntax: second(time)
arguments: time is any valid time expression.
example: <%=second(#12:34:28 pm#)%>
result: 28
————————————-
37. strreverse()
function: returns a string where the character order has been reversed
syntax:strreverse(string)
arguments: string is any valid string expression
example: <%
strtest = “this is a test!!”
response.write strreverse(strtest)
%>
result: !!tset a si siht
————————————-
38. time()
function: returns the current system time.
syntax: time()
arguments: none.
example: <%=time%>
result: 9:58:28 am
————————————-
39. trim()
function: returns a string without leading and trailing spaces.
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!!
————————————-
40. ubound()
function: returns the largest available subscipt for a dimension of an array.
syntax: ubound(arrayname [, dimension])
arguments: arrayname is the name of a valid array; dimension (optional) is a number indicating the
dimension to find the upper bound.
example: <%
i = array(“monday”,”tuesday”,”wednesday”)
response.write ubound(i)
%>
result: 2
(array index starts with 0)
————————————-
41. ucase()
function: returns a string that has been converted to uppercase characters.
syntax: ucase(string)
arguments: string is any valid string expression.
example: <%
strtest = “this is a test!!”
response.write ucase(strtest)
%>
result: this is a test!!
————————————-
42. vartype()
function: returns the subtype of a variable
syntax: vartype(varname)
arguments: varname is the required variable name
example: <%
i = 3
response.write vartype(i)
%>
result: 2
(2 indicates integer. refers to asp constants)
————————————-
43. weekday()
function: returns a whole number representing the day of the week.
syntax: weekday(date [, firstdayofweek])
arguments: date is any valid date expression; firstdayofweek is an optional date constant to assign the
first day of week.
example: <%
d = #8/4/99#
response.write weekday(d)
%>
result: 4
(4 indicates the fourth of the week, which is wednesday)
————————————-
44. weekdayname()
function: returns the specified day of the week.
syntax: weekdayname(weekday [, abb [, firstdayofweek]])
arguments: weekday is the numeric representation for the day of the week; abb is an optional boolean
value (if set to true, the weekday name will be abbreviated; if set to false, the full weekday name is
displayed); and firstdayofweek is an optional date constant to assign the first day of week.
example: <%
d = #8/4/99#
response.write weekdayname(weekday(d))
%>
result: wednesday
————————————-
45. year()
function: returns the current year.
syntax: year(date)
arguments: date is any valid date expression.
example: <%=year(#8/4/99#)%>
ASP中的函数应用方法及应用举例(二)-ASP教程,ASP应用
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ASP中的函数应用方法及应用举例(二)-ASP教程,ASP应用
相关推荐
-      ASP 简介
-      SQL注入天书 – ASP注入漏洞全接触
-      用.net 处理xmlHttp发送异步请求
-      asp.net创建文件夹的IO类的问题
-      如何实现ASP.NET网站个性化
-      关于ASP.NET调用JavaScript的实现
-      ASP利用Google实现在线翻译功能
-      Asp无组件生成缩略图