ASP中的函数应用方法及应用举例(二)
2011-7-25编辑:mal
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 th