IsObject()
Function determines whether an object is an object, | Boolean value.
Expression IsObject(expression)
Example: <%
Set con = ("")
IsObject(con)
%>
| Results: True
Lbound()
Function | Specify the minimum available subscript for array dimensions.
Expression Lbound(arrayname [, dimension])
Example: <%
I = Array("Monday","Tuesday","Wednesday")
Lbound(I)
%>
| Results: 0
Lcase()
Function | lowercase form of string
Expression Lcase(string)
Example: <%
strTest = "This is a test!"
Lcase(strTest)
%>
| Results: this is a test!
Left()
Function | Character before the length character on the left side of the string (including the length character).
Expression Left(string, length)
Example: <%
strTest = "This is a test!"
Left(strTest, 3)
%>
| Results: Thi
Len()
Function | length of string.
Expression Len(string | varName)
Example: <%
strTest = "This is a test!"
Len(strTest)
%>
| Results: 15
Ltrim()
The function removes the spaces on the left side of the string.
Expression Ltrim(string)
Example: <%
strTest = " This is a test!"
Ltrim(strTest)
%>
| Results: This is a test!
Mid()
Function | A string of a specific length (start from start, length is length).
Expression Mid(string, start [, length])
Example: <%
strTest = "This is a test! Today is Monday."
Mid(strTest, 17, 5)
%>
| Results: Today
Minute()
Function | Minutes of time.
Expression Minute(time)
Example: <%=Minute(#12:45:32 PM#)%>
| Results: 45
Month()
Function | Date.
Expression Month(date)
Example: <%=Month(#08/04/99#)%>
| Results: 8
MonthName()
Function | Specify month
Expression MonthName(month, [, Abb])
Example: <%=MonthName(Month(#08/04/99#))%>
| Results: August
Now()
Function | System Time
Expression Now()
Example: <%=Now%>
| Results: 9/9/00 9:30:16 AM
Right()
Function | Character before the length character on the right side of the string (including the length character).
Expression Right(string, length)
Example: <%
strTest = "This is an test!"
Right(strTest, 3)
%>
| Results: st!
Rnd()
The function generates a random number.
Expression Rnd [ (number) ]
Example: <%
Randomize()
RND()
%>
| Result: Any number between 0 and 1
Waiting Posted on 2008-2-25 17:08
instr Find Index Function
instr function
expression:
InStr([start, ]string1, string2[, compare])
describe:
start
Optional parameters. For numeric expressions, set the starting point for each search. If omitted, it will start from the position of the first character. If start contains Null, an error occurs. If the compare parameter is specified, you must have the start parameter.
string1
Required parameters. A string expression that accepts searches.
string2
Required parameters. The string expression being searched for.
Compare
Optional parameters. Specifies string comparison. If compare is Null, an error will occur. If compare is omitted, the Option Compare setting will determine the type of comparison.
The compare parameter is set to:
constant
value
describe
vbUseCompareOption
-1
Use the Option Compare statement to set a comparison.
vbBinaryCompare
0
Perform a binary comparison.
vbTextCompare
1
Perform a comparison according to the original text.
vbDatabaseCompare
2
Applicable to Microsoft Access only, performs a comparison based on information in the database.
Return value
Returns 0, 1, 2, -1 or Null, etc.
Exception/Error
none
Description InStr([start, ]string1, string2[, compare])
Returns the location where a string first appears in another string. In the string string1, start looking for string2 from start, and start looking for string1 when omitting start. When not found, the function value is 0.
if
InStr Return
string1 is zero length
0
string1 is Null
Null
string2 is zero length
Start
string2 is Null
Null
string2 not found
0
Find string2 in string1
Location found
start > string2
0
Example
This example uses the InStr function to find where a string first appears in another string.
Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP" ' The string being searched for.
SearchChar = "P" ' To find the string "P".
' Start with the fourth character and start with text comparison. The return value is 6 (lowercase p).
' Lowercase p and uppercase P are the same in text comparison.
MyPos = Instr(4, SearchString, SearchChar, 1)
' Start from the first character and start by binary comparison. The return value is 9 (caps P).
' Lowercase p and uppercase P are different in binary comparison.
MyPos = Instr(1, SearchString, SearchChar, 0)
' The default alignment method is binary comparison (the last parameter can be omitted).
MyPos = Instr(SearchString, SearchChar) ' Returns 9.
MyPos = Instr(1, SearchString, "W") ' Returns 0.