DIAdem Help

Content Type
Programming Language
Current manual
Table of Contents

Method: InStrRev for VBS

Method: InStrRev for VBS

Specifies the position in the text where a character or a character string appears in the text for the first time, whereby the search begins at the end of the text.

vInStrRev = Object.InStrRev(string1, string2, [start], [compare])
ObjectVBS
Object with this method. You do not need to specify this object.
string1Variant
Specifies the text you want to search through.
string2Variant
Specifies the character string you want to search for.
[start]Variant
Specifies the start position of the search. If you do not specify start, the InStrRev method uses the value -1, which indicates that the search begins with the last character.
[compare]Variant
Specifies the type of comparison. Possible settings are vbBinaryCompare and vbTextCompare. If you do not specify compare, the InStrRev method performs a binary comparison.
vInStrRevVariant

Receives the position of a character or a character string in a text. Possible return values:
ConditionReturn value
string1 is an empty string0
string1 or string2 is NullNull
string2 is an empty string1
string2 is not in string10
string2 is not in string1Position of string2
start is greater than the length of string10

The following example searches a text in various character strings:

Dim MyPos
MyPos = InStrRev("abcdabcde", "c")			'Returns 7
Call MsgBox(MyPos) 
MyPos = InStrRev("abcdabcde", "C")			'Returns 0
Call MsgBox(MyPos) 
MyPos = InStrRev("abcdabcde", "C", -1, vbTextCompare)	'Returns 7
Call MsgBox(MyPos)

See Also

Objects Overview

Related Topics

Filter | InStr | InStrB | InStrRev | Join | LCase | Left | LeftB | Len | LenB | LTrim | Mid | MidB | Replace | Right | RightB | RTrim | Space | Split | StrComp | String | StrReverse | Trim | UCase

In This Section
Was this information helpful?