InStrRev
The InStrRev function will search a character string
for a specified substring in reverse order (meaning starting the
search from the end of the string and moving toward the beginning.)
The function returns the position where the search string was found
if any.
The first parameter indicates the character string that should be
searched for the search text. This can be a variable, a string
literal or a database field from a query result.
Dim sText
sText = "The quick brown fox jumped over the lazy old dog" Response.Write "Position of the: " & InStrRev(sText, "the")
The third argument indicates what position in the character string
you want to begin the search from. This value can be anywhere from
1 (the beginning of the search string) up to the length of the search
string. When left out, searching will begin at the end of the character
string.
' this should return a value of 1
Response.Write "Position of the: " & InStrRev(sText, "the", 10)
The optional fourth argument is the string comparison method to use
when searching for the substring. Valid values for this argument are
shown below along with an example of how to use them.
| ASP Variable |
Value |
Meaning |
| vbBinaryCompare |
0 |
Does a binary-level comparison (ASCII codes) for the characters
in the string. This is also known as a case-sensitive comparison. |
| vbTextCompare |
1 |
Does a text-level comparison for the characters in the string.
This is also known as a case-insensitive comparison. |
' lets do a case sensative search
Response.Write "position of The = " & InStrRev(sText, "Over", 0, vbBinaryCompare)
|
 |

|