Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

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)


Orvado, San Diego Web Design

ASP Nuke CMS
Free Open Source
Content Manager
GoSwap Auctions
Buy, Sell
No Fees!

Contact Us | Contribute | About | Site Map



"It is better to deserve honors and not have them than to have them and not deserve them." - Mark Twain

©2012 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.