Microsoft (R) Visual Basic (R) Scripting Editioninstrrev Function Language Reference
Start page |
Version 2
See
description
Returns a certain position from the end of the end in another string.
grammar
INSTRREV (
String1
,
String2 [
,
START [
,
Compare]]]
)
The syntax of the INSTRREV function has the following parameters:
Parameter Description String1 must. Accept the search for string expressions. String2 must be selected. String character string expression. START is optional. Numerical expressions for setting the start position of each search. If omitted, the default value is -1, indicating that the search from the last character position. If Start contains NULL, an error will occur. Compare is optional. When calculating a sub-string, indicating the value of the comparison type to use. If omitted, a binary comparison will be performed. For values, see the "Settings" section.
Set
Compare parameters can have the following values:
Constant Value Description VbinaryCompare0 performs binary comparison. VBDatabaseCompare2 performs comparisons based on information included in the database (in this database).
return value
INSTRREV returns the following values:
If INSTRREV returns String1 to zero length 0String1 to nullnullstring2 for zero length StartString2 for nullnullstring2 No 0 found String2 found in string1 String2 Location START> LEN (String2) 0
Description
The following example utilization
Instrrev function search string:
Dim searchstring, seechchar, mypos
SearchString = "xxpxxpxxpxxp" "The string you want to search.
SearchChar = "p" 'Search "P".
'Binary comparison begins with the 10th character. Returns 9.
Mypos = Instrrev (SearchString, Searchchar, 10, 0)
'Text comparison begins with the last character. Returns 12.
Mypos = INSTRREV (SearchString, Searchchar, -1, 1)
'Default is binary comparison (the last parameter is omitted). Returns 0.
MyPOS = Instrrev (SearchString, Searchchar, 8)
Note The syntax of the Instrrev function is different from the syntax of the INSTR function.
(C) 1998 Microsoft Corporation. All Rights Reserved. Terms of Use.